instantiate-declref-ice.cpp 667 B

1234567891011121314151617181920212223242526272829303132333435
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. // expected-no-diagnostics
  3. template<int i> struct x {
  4. static const int j = i;
  5. x<j>* y;
  6. };
  7. template<int i>
  8. const int x<i>::j;
  9. int array0[x<2>::j];
  10. template<typename T>
  11. struct X0 {
  12. static const unsigned value = sizeof(T);
  13. };
  14. template<typename T>
  15. const unsigned X0<T>::value;
  16. int array1[X0<int>::value == sizeof(int)? 1 : -1];
  17. const unsigned& testX0() { return X0<int>::value; }
  18. int array2[X0<int>::value == sizeof(int)? 1 : -1];
  19. template<typename T>
  20. struct X1 {
  21. static const unsigned value;
  22. };
  23. template<typename T>
  24. const unsigned X1<T>::value = sizeof(T);
  25. int array3[X1<int>::value == sizeof(int)? 1 : -1];