gcc/testsuite/g++.dg/template/non-dependent18.C
raw| 1 | // PR c++/103831 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct A { |
| 5 | constexpr int size() { return 42; } // non-static |
| 6 | }; |
| 7 | |
| 8 | template<class T> |
| 9 | struct B : T { |
| 10 | static_assert(A::size() == 42, ""); // { dg-error "without object" } |
| 11 | |
| 12 | static int f() { |
| 13 | static_assert(A::size() == 42, ""); // { dg-error "without object" } |
| 14 | return A::size(); // { dg-error "without object" } |
| 15 | } |
| 16 | |
| 17 | int n = A::size(); |
| 18 | static const int m = A::size(); // { dg-error "without object" } |
| 19 | }; |