1 // Test that we explain why a template instantiation isn't constexpr 2 // { dg-do compile { target c++11 } } 3 4 template <class T> 5 struct A 6 { 7 T t; fA8 constexpr int f() const { return 42; } // { dg-error "enclosing class" "" { target c++11_only } } 9 }; 10 11 struct B { B(); operator int(); }; 12 13 constexpr A<int> ai = { 42 }; 14 constexpr int i = ai.f(); 15 16 constexpr int b = A<B>().f(); // { dg-error "" } 17 18 template <class T> f(T t)19constexpr int f (T t) { return 42; } 20 constexpr int x = f(B()); // { dg-error "non-literal" } 21