gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C
raw| 1 | // PR c++/57901 |
| 2 | // { dg-require-effective-target c++11 } |
| 3 | |
| 4 | struct Z { |
| 5 | Z() = default; |
| 6 | Z(Z const&) = default; |
| 7 | constexpr Z(Z&&) {} /* non-trivial (constexpr) move ctor */ |
| 8 | }; |
| 9 | |
| 10 | template<typename T> |
| 11 | constexpr int fn0(T v) { return 0; } |
| 12 | template<typename T> |
| 13 | constexpr int fn (T v) { return fn0(v); } |
| 14 | |
| 15 | constexpr auto t0 = fn0(Z()); // OK! |
| 16 | constexpr auto t = fn (Z()); // error! (GCC 4.8.1) |