gcc/testsuite/g++.dg/cpp1y/var-templ74.C
raw| 1 | // PR c++/107938 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | struct Q { |
| 5 | int n; |
| 6 | constexpr const Q* operator()(int) const { return this; } |
| 7 | }; |
| 8 | |
| 9 | extern const Q q; |
| 10 | |
| 11 | template<int> |
| 12 | constexpr const Q* p = q(0); |
| 13 | |
| 14 | void |
| 15 | g () |
| 16 | { |
| 17 | constexpr const Q* p2 = q(0); |
| 18 | constexpr auto x = p<0>; |
| 19 | } |