instantiation-default-2.cpp 672 B

123456789101112131415161718
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. template<typename T, T Value> struct Constant; // expected-note{{template parameter is declared here}} \
  3. // FIXME: bad location expected-error{{a non-type template parameter cannot have type 'float'}}
  4. Constant<int, 5> *c1;
  5. int x;
  6. float f(int, double);
  7. Constant<int&, x> *c2;
  8. Constant<int*, &x> *c3;
  9. Constant<float (*)(int, double), f> *c4;
  10. Constant<float (*)(int, double), &f> *c5;
  11. Constant<float (*)(int, int), f> *c6; // expected-error{{non-type template argument of type 'float (int, double)' cannot be converted to a value of type 'float (*)(int, int)'}}
  12. Constant<float, 0> *c7; // expected-note{{while substituting}}