/cp
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / static_assert3.C
blob7bdc919b4d686bc6f6a172a93fe07cd20f2a42b5
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-fdiagnostics-show-caret" }
4 class is_not_empty
6   int i;
7 };
9 /* Verify location of static_assert failure (and of traits).  */
11 static_assert(__is_empty(is_not_empty), "message"); // { dg-error "static assertion failed: message" }
12 /* { dg-begin-multiline-output "" }
13  static_assert(__is_empty(is_not_empty), "message");
14                ^~~~~~~~~~~~~~~~~~~~~~~~
15    { dg-end-multiline-output "" } */
18 /* Again, this time verifying location of "noexcept".  */
20 extern void might_throw ();
22 static_assert(noexcept(might_throw ()), "message"); // { dg-error "static assertion failed: message" }
23 /* { dg-begin-multiline-output "" }
24  static_assert(noexcept(might_throw ()), "message");
25                ^~~~~~~~~~~~~~~~~~~~~~~~
26    { dg-end-multiline-output "" } */