]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-diag1.C
CommitLineData
fa2200cb 1// Test that we explain why a template instantiation isn't constexpr
4b2e63de 2// { dg-do compile { target c++11 } }
fa2200cb
JM
3
4template <class T>
5struct A
6{
7 T t;
54069e59 8 constexpr int f() const { return 42; } // { dg-error "enclosing class" "" { target c++11_only } }
fa2200cb
JM
9};
10
11struct B { B(); operator int(); };
12
13constexpr A<int> ai = { 42 };
14constexpr int i = ai.f();
15
54069e59 16constexpr int b = A<B>().f(); // { dg-error "" }
fa2200cb
JM
17
18template <class T>
4b691b13
JM
19constexpr int f (T t) { return 42; }
20constexpr int x = f(B()); // { dg-error "non-literal" }
This page took 6.241608 seconds and 5 git commands to generate.