* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / sfinae11.C
blob89bd76da8d2753e873f6c103aec15f3baa8ba599
1 // PR c++/48468
2 // { dg-do compile { target c++11 } }
3 // { dg-prune-output "note" }
5 template<class T>
6 T&& declval() noexcept;
8 template< class T >
9 inline void f1( T& x ) noexcept( noexcept( declval<T&>().foo() ) ) // { dg-error "Z" }
11   x.foo();
14 template< class T,
15   bool Noexcept = noexcept( declval<T&>().foo() ) // { dg-error "no member|not convert" }
18 inline void f2( T& x ) noexcept( Noexcept )
20   x.foo();
23 // a common and trivial mistake
24 template< class T >
25 inline void f3( T& x ) noexcept( declval<T&>().foo() ) // { dg-error "Z" }
27   x.foo();
30 struct X
32   void foo();
35 struct Y
37   void foo() noexcept;
40 struct Z {};
42 int main()
44   X x; Y y; Z z;
46   static_assert( !noexcept( f1(x) ), "OK." );
47   static_assert( !noexcept( f2(x) ), "OK." );
48   // static_assert( !noexcept( f3(x) ), "shall be ill-formed(OK)." );
50   static_assert(  noexcept( f1(y) ), "OK." );
51   static_assert(  noexcept( f2(y) ), "OK." );
52   // static_assert(  noexcept( f3(y) ), "shall be ill-formed(OK)." );
54   noexcept( f1(z) );            // { dg-message "required" }
55   static_assert(  noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match" }
56   noexcept( f3(z) );            // { dg-message "required" }