view gcc/testsuite/g++.dg/cpp1y/static_assert3.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// { dg-do compile { target c++11 } }
// { dg-options "-fdiagnostics-show-caret" }

class is_not_empty
{
  int i;
};

/* Verify location of static_assert failure (and of traits).  */

static_assert(__is_empty(is_not_empty), "message"); // { dg-error "static assertion failed: message" }
/* { dg-begin-multiline-output "" }
 static_assert(__is_empty(is_not_empty), "message");
               ^~~~~~~~~~~~~~~~~~~~~~~~
   { dg-end-multiline-output "" } */


/* Again, this time verifying location of "noexcept".  */

extern void might_throw ();

static_assert(noexcept(might_throw ()), "message"); // { dg-error "static assertion failed: message" }
/* { dg-begin-multiline-output "" }
 static_assert(noexcept(might_throw ()), "message");
               ^~~~~~~~~~~~~~~~~~~~~~~~
   { dg-end-multiline-output "" } */