diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C new file mode 100644 index 000000000..dc393d759 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C @@ -0,0 +1,16 @@ +// The FCD doesn't allow typedefs and static_assert in constexpr functions, +// but it should. +// { dg-options "-std=c++0x -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); +} |