gcc/testsuite/g++.dg/cpp1y/pr91845.C
raw| 1 | // PR c++/91845 - ICE with invalid pointer-to-member. |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | void non_const_mem_ptr() { |
| 5 | struct A { |
| 6 | }; |
| 7 | constexpr A a = {1, 2}; // { dg-error "too many initializers" } |
| 8 | struct B { |
| 9 | int A::*p; |
| 10 | constexpr int g() const { |
| 11 | return a.*p; // { dg-error "use of local variable" } |
| 12 | }; |
| 13 | }; |
| 14 | } |