2 // { dg-do compile { target c++11 } }
3 // { dg-prune-output "note" }
6 T&& declval() noexcept;
9 inline void f1( T& x ) noexcept( noexcept( declval<T&>().foo() ) ) // { dg-error "Z" }
15 bool Noexcept = noexcept( declval<T&>().foo() ) // { dg-error "no member|not convert" }
18 inline void f2( T& x ) noexcept( Noexcept )
23 // a common and trivial mistake
25 inline void f3( T& x ) noexcept( declval<T&>().foo() ) // { dg-error "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" }