gcc/testsuite/g++.dg/cpp0x/constexpr-decltype4.C
raw| 1 | // PR c++/52269 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename T> |
| 5 | int f(T x) |
| 6 | { |
| 7 | return x.get(); |
| 8 | } |
| 9 | |
| 10 | // O.K. The body of `f' is not required. |
| 11 | decltype(f(0)) a; |
| 12 | |
| 13 | template<typename T> |
| 14 | constexpr int g(T x) |
| 15 | { |
| 16 | return x.get(); |
| 17 | } |
| 18 | |
| 19 | // Seems to instantiate the body of `g' |
| 20 | // and results in an error. |
| 21 | decltype(g(0)) b; |