gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
raw| 1 | // PR c++/58612 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A |
| 5 | { |
| 6 | int foo() const { return 0; } |
| 7 | }; |
| 8 | |
| 9 | template<typename> struct B |
| 10 | { |
| 11 | A a; |
| 12 | constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target { ! implicit_constexpr } } } |
| 13 | }; |
| 14 | |
| 15 | constexpr int i = B<void>().bar(); // { dg-error "bar" "" { target { ! implicit_constexpr } } } |