Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/constexpr-pedantic.C

raw
1 // The FCD doesn't allow typedefs and static_assert in constexpr functions,
2 // but it should.
3 // { dg-do compile { target c++11 } }
4 // { dg-options "-pedantic" }
5
6 template <class T>
7 constexpr T f(T t)
8 {
9 typedef T T2; // { dg-warning "constexpr" "" { xfail *-*-* } }
10 static_assert (T2(0) == T(0), ""); // { dg-warning "constexpr" "" { xfail *-*-* } }
11 return t;
12 }
13
14 int main()
15 {
16 constexpr int i = f(42);
17 }