diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C new file mode 100644 index 0000000..21f4c83 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C @@ -0,0 +1,17 @@ +// The FCD doesn't allow typedefs and static_assert in constexpr functions, +// but it should. +// { dg-do compile { target c++11 } } +// { dg-options "-pedantic" } + +template <class T> +constexpr T f(T t) +{ + typedef T T2; // { dg-warning "constexpr" "" { xfail *-*-* } } + static_assert (T2(0) == T(0), ""); // { dg-warning "constexpr" "" { xfail *-*-* } } + return t; +} + +int main() +{ + constexpr int i = f(42); +} |