1*67e74705SXin Li // RUN: %clang_cc1 -verify -std=c++1y %s 2*67e74705SXin Li 3*67e74705SXin Li namespace PR17846 { 4*67e74705SXin Li template <typename T> constexpr T pi = T(3.14); 5*67e74705SXin Li template <typename T> constexpr T tau = 2 * pi<T>; 6*67e74705SXin Li constexpr double tau_double = tau<double>; 7*67e74705SXin Li static_assert(tau_double == 6.28, ""); 8*67e74705SXin Li } 9*67e74705SXin Li 10*67e74705SXin Li namespace PR17848 { 11*67e74705SXin Li template<typename T> constexpr T var = 12345; f()12*67e74705SXin Li template<typename T> constexpr T f() { return var<T>; } 13*67e74705SXin Li constexpr int k = f<int>(); 14*67e74705SXin Li static_assert(k == 12345, ""); 15*67e74705SXin Li } 16*67e74705SXin Li 17*67e74705SXin Li namespace NonDependent { 18*67e74705SXin Li template<typename T> constexpr T a = 0; 19*67e74705SXin Li template<typename T> constexpr T b = a<int>; 20*67e74705SXin Li static_assert(b<int> == 0, ""); 21*67e74705SXin Li } 22*67e74705SXin Li 23*67e74705SXin Li namespace InstantiationDependent { 24*67e74705SXin Li int f(int); 25*67e74705SXin Li void f(char); 26*67e74705SXin Li 27*67e74705SXin Li template<int> constexpr int a = 1; 28*67e74705SXin Li template<typename T> constexpr T b = a<sizeof(sizeof(f(T())))>; // expected-error {{invalid application of 'sizeof' to an incomplete type 'void'}} 29*67e74705SXin Li 30*67e74705SXin Li static_assert(b<int> == 1, ""); 31*67e74705SXin Li static_assert(b<char> == 1, ""); // expected-note {{in instantiation of}} expected-error {{not an integral constant}} 32*67e74705SXin Li f()33*67e74705SXin Li template<typename T> void f() { 34*67e74705SXin Li static_assert(a<sizeof(sizeof(f(T())))> == 0, ""); // expected-error {{static_assert failed}} 35*67e74705SXin Li } 36*67e74705SXin Li } 37*67e74705SXin Li 38*67e74705SXin Li namespace PR24483 { 39*67e74705SXin Li template<typename> struct A; 40*67e74705SXin Li template<typename... T> A<T...> models; 41*67e74705SXin Li template<> struct B models<>; // expected-error {{incomplete type 'struct B'}} expected-note {{forward declaration}} 42*67e74705SXin Li } 43