mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 12:00:11 -05:00
gcc/cp/ChangeLog: * parser.c (cp_parser_unary_expression): Generate a location for "noexcept". (cp_parser_trait_expr): Generate and return a location_t, converting the return type from tree to cp_expr. (cp_parser_static_assert): Pass location of the condition to finish_static_assert, rather than that of the "static_assert" token, where available. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/static_assert3.C: New test case. libstdc++-v3/ChangeLog: * testsuite/20_util/duration/literals/range.cc: Update expected line of a static_assert failure. From-SVN: r255255
27 lines
812 B
C
27 lines
812 B
C
// { 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 "" } */
|