From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 49AE1385841B for ; Sat, 22 Jul 2023 05:27:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49AE1385841B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6b9e478e122so2344706a34.1 for ; Fri, 21 Jul 2023 22:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690003625; x=1690608425; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ihob2MO8A7OPJuLhloGzwjCo68wXHLISSFo+8LStZyE=; b=FjTbxEofuvoCL6htEgHdXbAFadcSjdZGeHFYxX0HOiv/853JxHfSxK5C0MW7y685m4 Oa3+aT9ujG7Nuct5w/Uu68w5vOcE/DqVqWNRiSTeNSlh8F/fO1fF1DGgDnzHptwUo5Ai JqR4vUIi9nUy3iecwC7ly1blY4SvLoCPE3HesoNp+ZjZ70fPR59e1Ous99J1K+d+nJ9i OB04/eniGzURRNHGOQ3JwK2DlelOeBiMaqB7dZNo7G1nlHOGOWd/YfKf2tYn594NULSb cQCMs5/OWbta9ImRJimX1klO9I1PnC0C28TGhQUw+ZH5p1j/aoKDrxBaaylFI+WMEsf0 Dg6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690003625; x=1690608425; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ihob2MO8A7OPJuLhloGzwjCo68wXHLISSFo+8LStZyE=; b=R4GKufR+KNEmeAUEkNqmGjEc4FtRQlkucJP/g5KLsbGcyyM99DeLJgVk9gCRsHVaOv WEmswR+tcRk2yrMH5WEdmAyooBGEbBGYvk277ye/XYEqC2XL1DiDWwUvlQ2ELlTgiYTe wmVlBD0gAZFxXqS7Jk1j8VHDDPQrjGYt497cwSu7SQGDlgwX0E3DsVB8GrwkF/wGrcej t+LhWsehQHvaC4EVJgFVzTmZsjQ9jY12bdp9tPLTnbWHkGRoLc8Mzwj+pQwvOrbqmmFK mcnb8RTkfCSeZbGDhqWWcsSgVMt4pdzTp7h3eRUIm+nk5iccZ20bWLb54qm5aMVRL5AK HjvQ== X-Gm-Message-State: ABy/qLZkCffiab6SPS79GFofd6XMkmOQwLfS4qvNpfh1njUe/Draa5yR GqYvgLADJHoedAODOqT7qCwrfpJ+ComtnVtAYEmn+oYp X-Google-Smtp-Source: APBJJlFSjYNDiEP9XeNcdRKdXe5lE8JKNO7JK2fmlpErIoH642Ig9iqH0hzv+sGCKjBb6EQmZ2lAivKYe+LNWf/2rFw= X-Received: by 2002:aca:1c03:0:b0:39a:bd0e:43d with SMTP id c3-20020aca1c03000000b0039abd0e043dmr4241363oic.36.1690003624788; Fri, 21 Jul 2023 22:27:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nathaniel Shead Date: Sat, 22 Jul 2023 15:26:53 +1000 Message-ID: Subject: Re: [PATCH v4 3/3] c++: Improve location information in constant evaluation To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Patrick Palka Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URI_HEX autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Jul 21, 2023 at 3:00=E2=80=AFAM Jason Merrill wr= ote: > > On 7/20/23 05:37, Nathaniel Shead wrote: > > This patch updates 'input_location' during constant evaluation to ensur= e > > that errors in subexpressions that lack location information still > > provide accurate diagnostics. > > > > By itself this change causes some small regressions in diagnostic > > quality for circumstances where errors used 'input_location' but the > > location of the parent subexpression doesn't make sense, so this patch > > also includes a couple of other small diagnostic improvements to improv= e > > the most egregious cases. > > > > gcc/cp/ChangeLog: > > > > * constexpr.cc (modifying_const_object_error): Find the source > > location of the const object's declaration. > > (cxx_eval_store_expression): Fall back to the location of the > > target object when evaluating initialiser. > > I'm skeptical about this workaround being an improvement in general. > Reverting it, there only seems to be a difference for constexpr-89285.C, > which seems fine; we see the location as the first line of the class, as > usual for implicitly declared constructors. > > Showing the DMI location might be an improvement, but I think it would > be better to make that change in perform_member_init so it applies to > runtime as well. Makes sense, I'll get rid of it. > > (cxx_eval_constant_expression): Update input_location to the loca= tion > > of the currently evaluated expression, if possible. > > > > libstdc++-v3/ChangeLog: > > > > * testsuite/25_algorithms/equal/constexpr_neg.cc: Update diagnost= ic > > locations. > > * testsuite/26_numerics/gcd/105844.cc: Likewise. > > * testsuite/26_numerics/lcm/105844.cc: Likewise. > > > > gcc/testsuite/ChangeLog: > > > > * g++.dg/cpp0x/constexpr-48089.C: Update diagnostic locations. > > * g++.dg/cpp0x/constexpr-70323.C: Likewise. > > * g++.dg/cpp0x/constexpr-70323a.C: Likewise. > > * g++.dg/cpp0x/constexpr-delete2.C: Likewise. > > * g++.dg/cpp0x/constexpr-diag3.C: Likewise. > > * g++.dg/cpp0x/constexpr-ice20.C: Likewise. > > * g++.dg/cpp0x/constexpr-recursion.C: Likewise. > > * g++.dg/cpp0x/overflow1.C: Likewise. > > * g++.dg/cpp1y/constexpr-89285.C: Likewise. > > * g++.dg/cpp1y/constexpr-89481.C: Likewise. > > * g++.dg/cpp1y/constexpr-lifetime1.C: Likewise. > > * g++.dg/cpp1y/constexpr-lifetime2.C: Likewise. > > * g++.dg/cpp1y/constexpr-lifetime3.C: Likewise. > > * g++.dg/cpp1y/constexpr-lifetime4.C: Likewise. > > * g++.dg/cpp1y/constexpr-lifetime5.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const14.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const16.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const18.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const19.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const21.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const22.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const3.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const4.C: Likewise. > > * g++.dg/cpp1y/constexpr-tracking-const7.C: Likewise. > > * g++.dg/cpp1y/constexpr-union5.C: Likewise. > > * g++.dg/cpp1y/pr68180.C: Likewise. > > * g++.dg/cpp1z/constexpr-lambda6.C: Likewise. > > * g++.dg/cpp1z/constexpr-lambda8.C: Likewise. > > * g++.dg/cpp2a/bit-cast11.C: Likewise. > > * g++.dg/cpp2a/bit-cast12.C: Likewise. > > * g++.dg/cpp2a/bit-cast14.C: Likewise. > > * g++.dg/cpp2a/constexpr-98122.C: Likewise. > > * g++.dg/cpp2a/constexpr-dynamic17.C: Likewise. > > * g++.dg/cpp2a/constexpr-init1.C: Likewise. > > * g++.dg/cpp2a/constexpr-new12.C: Likewise. > > * g++.dg/cpp2a/constexpr-new3.C: Likewise. > > * g++.dg/cpp2a/constinit10.C: Likewise. > > * g++.dg/cpp2a/is-corresponding-member4.C: Likewise. > > * g++.dg/ext/constexpr-vla2.C: Likewise. > > * g++.dg/ext/constexpr-vla3.C: Likewise. > > * g++.dg/ubsan/pr63956.C: Likewise. > > > > Signed-off-by: Nathaniel Shead > > --- > > gcc/cp/constexpr.cc | 46 ++++++++++++++++++= - > > gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | 10 ++-- > > gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C | 8 ++-- > > gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C | 8 ++-- > > .../g++.dg/cpp0x/constexpr-delete2.C | 5 +- > > gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C | 2 +- > > gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C | 1 + > > .../g++.dg/cpp0x/constexpr-recursion.C | 6 +-- > > gcc/testsuite/g++.dg/cpp0x/overflow1.C | 2 +- > > gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C | 5 +- > > gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C | 3 +- > > .../g++.dg/cpp1y/constexpr-lifetime1.C | 1 + > > .../g++.dg/cpp1y/constexpr-lifetime2.C | 4 +- > > .../g++.dg/cpp1y/constexpr-lifetime3.C | 4 +- > > .../g++.dg/cpp1y/constexpr-lifetime4.C | 2 +- > > .../g++.dg/cpp1y/constexpr-lifetime5.C | 4 +- > > .../g++.dg/cpp1y/constexpr-tracking-const14.C | 3 +- > > .../g++.dg/cpp1y/constexpr-tracking-const16.C | 3 +- > > .../g++.dg/cpp1y/constexpr-tracking-const18.C | 4 +- > > .../g++.dg/cpp1y/constexpr-tracking-const19.C | 4 +- > > .../g++.dg/cpp1y/constexpr-tracking-const21.C | 4 +- > > .../g++.dg/cpp1y/constexpr-tracking-const22.C | 4 +- > > .../g++.dg/cpp1y/constexpr-tracking-const3.C | 3 +- > > .../g++.dg/cpp1y/constexpr-tracking-const4.C | 3 +- > > .../g++.dg/cpp1y/constexpr-tracking-const7.C | 3 +- > > gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C | 4 +- > > gcc/testsuite/g++.dg/cpp1y/pr68180.C | 4 +- > > .../g++.dg/cpp1z/constexpr-lambda6.C | 4 +- > > .../g++.dg/cpp1z/constexpr-lambda8.C | 5 +- > > gcc/testsuite/g++.dg/cpp2a/bit-cast11.C | 10 ++-- > > gcc/testsuite/g++.dg/cpp2a/bit-cast12.C | 10 ++-- > > gcc/testsuite/g++.dg/cpp2a/bit-cast14.C | 14 +++--- > > gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C | 4 +- > > .../g++.dg/cpp2a/constexpr-dynamic17.C | 5 +- > > gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C | 5 +- > > gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C | 6 +-- > > gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C | 10 ++-- > > gcc/testsuite/g++.dg/cpp2a/constinit10.C | 5 +- > > .../g++.dg/cpp2a/is-corresponding-member4.C | 4 +- > > gcc/testsuite/g++.dg/ext/constexpr-vla2.C | 4 +- > > gcc/testsuite/g++.dg/ext/constexpr-vla3.C | 4 +- > > gcc/testsuite/g++.dg/ubsan/pr63956.C | 23 +++++----- > > .../25_algorithms/equal/constexpr_neg.cc | 7 +-- > > .../testsuite/26_numerics/gcd/105844.cc | 10 ++-- > > .../testsuite/26_numerics/lcm/105844.cc | 14 +++--- > > 45 files changed, 170 insertions(+), 124 deletions(-) > > > > diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc > > index cd4424bcb44..63e8274e0dc 100644 > > --- a/gcc/cp/constexpr.cc > > +++ b/gcc/cp/constexpr.cc > > @@ -2178,7 +2178,33 @@ modifying_const_object_error (tree expr, tree ob= j) > > auto_diagnostic_group d; > > error_at (loc, "modifying a const object %qE is not allowed in " > > "a constant expression", TREE_OPERAND (expr, 0)); > > - inform (location_of (obj), "originally declared % here"); > > + > > + /* Find the underlying object that was declared as const. */ > > + location_t decl_loc =3D UNKNOWN_LOCATION; > > + for (tree probe =3D obj; decl_loc =3D=3D UNKNOWN_LOCATION; ) > > + switch (TREE_CODE (probe)) > > + { > > + case BIT_FIELD_REF: > > + case COMPONENT_REF: > > + { > > + tree elt =3D TREE_OPERAND (probe, 1); > > + if (CP_TYPE_CONST_P (TREE_TYPE (elt))) > > + decl_loc =3D DECL_SOURCE_LOCATION (elt); > > + probe =3D TREE_OPERAND (probe, 0); > > + } > > + break; > > + > > + case ARRAY_REF: > > + case REALPART_EXPR: > > + case IMAGPART_EXPR: > > + probe =3D TREE_OPERAND (probe, 0); > > + break; > > + > > + default: > > + decl_loc =3D location_of (probe); > > + break; > > + } > > + inform (decl_loc, "originally declared % here"); > > } > > > > /* Return true if FNDECL is a replaceable global allocation function = that > > @@ -6276,6 +6302,21 @@ cxx_eval_store_expression (const constexpr_ctx *= ctx, tree t, > > if (TREE_CODE (init) =3D=3D TARGET_EXPR) > > if (tree tinit =3D TARGET_EXPR_INITIAL (init)) > > init =3D tinit; > > + > > + /* Improve error messages for initialisers when the initialising > > + expression has no location information by pointing to the decl > > + that is getting initialised. */ > > + location_t target_loc =3D cp_expr_loc_or_input_loc (init); > > + if (!EXPR_HAS_LOCATION (init)) > > + { > > + if (DECL_P (target)) > > + target_loc =3D DECL_SOURCE_LOCATION (target); > > + else if (TREE_CODE (target) =3D=3D COMPONENT_REF > > + || TREE_CODE (target) =3D=3D BIT_FIELD_REF) > > + target_loc =3D DECL_SOURCE_LOCATION (TREE_OPERAND (target, 1)= ); > > + } > > + iloc_sentinel sentinel =3D target_loc; > > + > > init =3D cxx_eval_constant_expression (&new_ctx, init, vc_prval= ue, > > non_constant_p, overflow_p); > > /* The hash table might have moved since the get earlier, and t= he > > @@ -6964,7 +7005,10 @@ cxx_eval_constant_expression (const constexpr_ct= x *ctx, tree t, > > return t; > > } > > > > + /* Change the input location to the currently processed expression f= or > > + better error messages when a subexpression has no location. */ > > location_t loc =3D cp_expr_loc_or_input_loc (t); > > + iloc_sentinel sentinel (loc); > > > > STRIP_ANY_LOCATION_WRAPPER (t); > > > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C b/gcc/testsui= te/g++.dg/cpp0x/constexpr-48089.C > > index 4574eb83ff7..11630f26ffe 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C > > @@ -10,11 +10,11 @@ > > // R() is well-formed because i is initialized before j. > > > > struct s { > > - constexpr s() : v(v) { } > > + constexpr s() : v(v) { } // { dg-error "accessing uninitialized memb= er" } > > int v; > > }; > > > > -constexpr s bang; // { dg-error "|" } > > +constexpr s bang; // { dg-message "in .constexpr. expansion" } > > > > struct R { > > int i,j; > > @@ -26,14 +26,14 @@ constexpr R r; // { dg-bogus "" = } > > // Ill-formed (no diagnostic required) > > struct T { > > int i; > > - constexpr int f() { return i; } > > + constexpr int f() { return i; } // { dg-error "accessing uninitiali= zed member" } > > constexpr T(): i(0) { } > > - constexpr T(const T& t) : i(f()) { } // { dg-message "" } > > + constexpr T(const T& t) : i(f()) { } // { dg-message "in .constexpr= . expansion" } > > }; > > > > constexpr T t1; > > // Ill-formed (diagnostic required) > > -constexpr T t2(t1); // { dg-message "" } > > +constexpr T t2(t1); // { dg-message "in .constexpr. expansion= " } > > > > // Well-formed > > struct U { > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C b/gcc/testsui= te/g++.dg/cpp0x/constexpr-70323.C > > index 272a225d967..bfb185f2fb5 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C > > @@ -1,10 +1,10 @@ > > // PR c++/70323 > > // { dg-do compile { target c++11 } } > > > > -constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; } > > -constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; } > > +constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; } // {= dg-error "overflow in constant expression" } > > +constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; } // {= dg-error "overflow in constant expression" } > > > > -constexpr bool i0_0 =3D overflow_if_0 (0); // { dg-error "overflow i= n constant expression|in .constexpr. expansion of " } > > +constexpr bool i0_0 =3D overflow_if_0 (0); // { dg-message "in .cons= texpr. expansion of " } > > constexpr bool i0_1 =3D overflow_if_0 (1); > > constexpr bool i1_0 =3D overflow_if_1 (0); > > -constexpr bool i1_1 =3D overflow_if_1 (1); // { dg-error "overflow i= n constant expression|in .constexpr. expansion of " } > > +constexpr bool i1_1 =3D overflow_if_1 (1); // { dg-message "in .cons= texpr. expansion of " } > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C b/gcc/testsu= ite/g++.dg/cpp0x/constexpr-70323a.C > > index 1990ab6be2d..b5ed581e1c8 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C > > @@ -2,10 +2,10 @@ > > // { dg-do compile { target c++11 } } > > // { dg-options "-Wall" } > > > > -constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; } > > -constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; } > > +constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; } // {= dg-error "overflow in constant expression" } > > +constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; } // {= dg-error "overflow in constant expression" } > > > > -constexpr bool i0_0 =3D overflow_if_0 (0); // { dg-error "overflow i= n constant expression|in .constexpr. expansion of" } > > +constexpr bool i0_0 =3D overflow_if_0 (0); // { dg-message "in .cons= texpr. expansion of" } > > constexpr bool i0_1 =3D overflow_if_0 (1); > > constexpr bool i1_0 =3D overflow_if_1 (0); > > -constexpr bool i1_1 =3D overflow_if_1 (1); // { dg-error "overflow i= n constant expression|in .constexpr. expansion of" } > > +constexpr bool i1_1 =3D overflow_if_1 (1); // { dg-message "in .cons= texpr. expansion of" } > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-delete2.C b/gcc/tests= uite/g++.dg/cpp0x/constexpr-delete2.C > > index 999f9b7851e..f2b6df2509c 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-delete2.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-delete2.C > > @@ -6,8 +6,9 @@ constexpr int f(int i) { return i; } > > constexpr int g(A* ap) > > { > > return f((delete[] ap, 42)); // { dg-message "" "" { target c++17_d= own } } > > + // { dg-error "" "" { target c++2a } .-= 1 } > > } > > > > A a; > > -constexpr int i =3D g(&a); // { dg-error "" } > > - // { dg-message "in 'constexpr' expansion= of" "" { target c++2a } .-1 } > > +constexpr int i =3D g(&a); // { dg-error "" "" { target c++17_down } = } > > + // { dg-message "in 'constexpr' expansion of" "= " { target c++2a } .-1 } > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C b/gcc/testsui= te/g++.dg/cpp0x/constexpr-diag3.C > > index 5eedf42ba36..50c676c56cd 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C > > @@ -16,7 +16,7 @@ int main() > > struct complex // { dg-message "no .constexpr. c= onstructor" "" { target { ! implicit_constexpr } } } > > { > > complex(double r, double i) : re(r), im(i) { } > > - constexpr double real() const { return re; } // { dg-error "not a li= teral type" "" { target c++11_only } } > > + constexpr double real() const { return re; } // { dg-error "not a li= teral type|not usable in a constant expression" "" { target { ! implicit_co= nstexpr } } } > > double imag() const { return im; } > > > > private: > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C b/gcc/testsui= te/g++.dg/cpp0x/constexpr-ice20.C > > index e2d4853a284..43fa9a03c14 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice20.C > > @@ -3,5 +3,6 @@ > > > > typedef bool (*Function)(int); > > constexpr bool check(int x, Function p) { return p(x); } // { dg-mes= sage "in .constexpr. expansion of" } > > +// { dg-error "not a constant expression" "" { target *-*-* } .-1 } > > > > static_assert(check(2, check), ""); // { dg-error "conversion|consta= nt|in .constexpr. expansion of" } > > diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C b/gcc/tes= tsuite/g++.dg/cpp0x/constexpr-recursion.C > > index 8c4201e1ec2..b00f8794d4c 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C > > @@ -1,6 +1,6 @@ > > // Test that we catch excessive recursion. > > // { dg-do compile { target c++11 } } > > // { dg-options "-fconstexpr-depth=3D5" } > > -// { dg-prune-output "in constexpr expansion" } > > -constexpr int f (int i) { return f (i-1); } // { dg-message "in .const= expr. expansion of " } > > -constexpr int i =3D f(42); // { dg-error ".constexpr. evaluation d= epth|in .constexpr. expansion of " } > > +// { dg-prune-output "in .constexpr. expansion" } > > +constexpr int f (int i) { return f (i-1); } // { dg-error ".constexpr.= evaluation depth" } > > +constexpr int i =3D f(42); > > diff --git a/gcc/testsuite/g++.dg/cpp0x/overflow1.C b/gcc/testsuite/g++= .dg/cpp0x/overflow1.C > > index b8591b4af41..e295355c88f 100644 > > --- a/gcc/testsuite/g++.dg/cpp0x/overflow1.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/overflow1.C > > @@ -4,7 +4,7 @@ template > > struct Fib > > { > > static const long long value // { dg-error "overflow" } > > - =3D Fib::value + Fib::value; > > + =3D Fib::value + Fib::value; // { dg-error "overflow" } > > }; > > > > template <> > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C b/gcc/testsui= te/g++.dg/cpp1y/constexpr-89285.C > > index fe0b8570ca2..d09df091fdb 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C > > @@ -14,7 +14,8 @@ struct B { > > } > > }; > > struct C : A { > > - B bar {this}; > > + B bar {this}; // { dg-error "" "" { target c++14_down } } > > }; > > > > -constexpr C foo {}; // { dg-message "" } > > +// error path changes in C++17 due to `C` becoming an aggregate > > +constexpr C foo {}; // { dg-error "" "" { target c++17 } } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C b/gcc/testsui= te/g++.dg/cpp1y/constexpr-89481.C > > index 8ac4ef0fd36..6f8f6a8038e 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89481.C > > @@ -6,7 +6,7 @@ foo () > > { > > union U { long long a; int b[2]; } u { 5LL }; > > u.b[1] =3D 4; // { dg-error "change of the active mem= ber of a union from" "" { target c++17_down } } > > - return u.b[0]; > > + return u.b[0]; // { dg-error "accessing uninitialized array elem= ent" "" { target c++2a } } > > } > > > > constexpr int > > @@ -19,6 +19,5 @@ bar () > > > > static_assert (foo () =3D=3D 0, ""); // { dg-error "non-constant c= ondition for static assertion" } > > // { dg-message "in 'constexpr' e= xpansion of" "" { target *-*-* } .-1 } > > - // { dg-error "accessing uninitia= lized array element" "" { target c++2a } .-2 } > > static_assert (bar () =3D=3D 4, ""); // { dg-error "non-constant c= ondition for static assertion" "" { target c++17_down } } > > // { dg-message "in 'constexpr' e= xpansion of" "" { target c++17_down } .-1 } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C b/gcc/tes= tsuite/g++.dg/cpp1y/constexpr-lifetime1.C > > index 43aa7c974c1..f79f1611d5f 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime1.C > > @@ -11,3 +11,4 @@ constexpr const int& test() { > > return local.get(); > > } > > constexpr int x =3D test(); // { dg-error "accessing object outside = its lifetime" } > > + > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C b/gcc/tes= tsuite/g++.dg/cpp1y/constexpr-lifetime2.C > > index 22cd919fcda..2f5ae8db6d5 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime2.C > > @@ -8,9 +8,9 @@ struct S { > > > > constexpr int error() { > > const auto& local =3D S{}.get(); // { dg-message "note: declared h= ere" } > > - return local; > > + return local; // { dg-error "accessing object outside its lifetime"= } > > } > > -constexpr int x =3D error(); // { dg-error "accessing object outside = its lifetime" } > > +constexpr int x =3D error(); // { dg-message "in .constexpr. expansio= n" } > > > > constexpr int ok() { > > // temporary should only be destroyed after end of full-expression > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C b/gcc/tes= tsuite/g++.dg/cpp1y/constexpr-lifetime3.C > > index 6329f8cf6c6..53785521d05 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime3.C > > @@ -7,7 +7,7 @@ constexpr int f(int i) { > > int j =3D 123; // { dg-message "note: declared here" } > > p =3D &j; > > } > > - return *p; > > + return *p; // { dg-error "accessing object outside its lifetime" } > > } > > > > -constexpr int i =3D f(0); // { dg-error "accessing object outside its= lifetime" } > > +constexpr int i =3D f(0); // { dg-message "in .constexpr. expansion" = } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C b/gcc/tes= tsuite/g++.dg/cpp1y/constexpr-lifetime4.C > > index 181a1201663..4302da1eddc 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime4.C > > @@ -5,7 +5,7 @@ constexpr const double& test() { > > return local; > > } > > > > -static_assert(test() =3D=3D 3.0, ""); // { dg-error "constant|accessi= ng object outside its lifetime" } > > +static_assert(test() =3D=3D 3.0, ""); // { dg-error "non-constant con= dition|accessing object outside its lifetime" } > > > > // no deference, shouldn't error > > static_assert((test(), true), ""); > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C b/gcc/tes= tsuite/g++.dg/cpp1y/constexpr-lifetime5.C > > index ad3ef579f63..a12920c8fba 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime5.C > > @@ -5,7 +5,7 @@ constexpr const int& id(int x) { return x; } // { dg-m= essage "note: declared he > > > > constexpr bool test() { > > const int& y =3D id(3); > > - return y =3D=3D 3; > > + return y =3D=3D 3; // { dg-error "accessing object outside its life= time" } > > } > > > > -constexpr bool x =3D test(); // { dg-error "accessing object outside = its lifetime" } > > +constexpr bool x =3D test(); // { dg-message "in .constexpr. expansio= n" } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const14.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const14.C > > index 45c4fcf50be..0c77dd4934d 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const14.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const14.C > > @@ -14,7 +14,7 @@ struct C { > > > > struct A { > > int r; > > - const C c; > > + const C c; // { dg-message "originally declared" } > > constexpr A() : r(11) { r =3D 14; const_cast(c).n =3D 42; } //= { dg-error "modifying a const object" } > > }; > > > > @@ -34,5 +34,4 @@ struct B { > > }; > > > > constexpr B b(false); // { dg-message "in .constexpr. expansion of" } > > -// { dg-message "originally declared" "" { target *-*-* } .-1 } > > static_assert(b.e.d.a.c.n =3D=3D 2, ""); // { dg-error "non-constant = condition" } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const16.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const16.C > > index 5a5b92bc8cc..b5ccf3a4ea5 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const16.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const16.C > > @@ -7,7 +7,7 @@ constexpr int& impl(const int (&array)[10], int index) = { > > > > struct A { > > constexpr int& operator[](int i) { return impl(elems, i); } > > - const int elems[10]; > > + const int elems[10]; // { dg-message "originally declared" } > > }; > > > > constexpr bool > > @@ -19,4 +19,3 @@ f() > > } > > > > constexpr bool b =3D f(); // { dg-message "in .constexpr. expansion o= f " } > > -// { dg-message "originally declared" "" { target *-*-* } .-1 } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const18.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const18.C > > index 11a680468c2..278628c121b 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const18.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const18.C > > @@ -13,11 +13,11 @@ struct array > > template > > struct S { > > using U =3D array; > > - const U m; > > + const U m; // { dg-message "originally declared" } > > constexpr S(int) : m{} > > { > > const_cast(const_cast(m)[0]) =3D 42; // { dg-er= ror "modifying a const object" } > > } > > }; > > > > -constexpr S p =3D { 10 }; // { dg-message "originally declared" } > > +constexpr S p =3D { 10 }; > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const19.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const19.C > > index c31222ffcdd..2d18c94537b 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const19.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const19.C > > @@ -7,7 +7,7 @@ template > > struct array > > { > > constexpr const E &operator[](size_t n) const noexcept { return ele= ms[n]; } > > - const E elems[N]; > > + const E elems[N]; // { dg-message "originally declared" } > > }; > > > > template > > @@ -20,4 +20,4 @@ struct S { > > } > > }; > > > > -constexpr S p =3D { 10 }; // { dg-message "originally declared" } > > +constexpr S p =3D { 10 }; > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const21.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const21.C > > index 0b16193398e..d3bbcb116a6 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const21.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const21.C > > @@ -18,11 +18,11 @@ struct array2 { > > template > > struct S { > > using U =3D array2; > > - const U m; > > + const U m; // { dg-message "originally declared" } > > constexpr S(int) : m{} > > { > > const_cast(m.a[0]) =3D 42; // { dg-error "modifying a cons= t object" } > > } > > }; > > > > -constexpr S p =3D { 10 }; // { dg-message "originally declared" } > > +constexpr S p =3D { 10 }; > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const22.C b/= gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const22.C > > index 216cf1607a4..27522f86dbd 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const22.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const22.C > > @@ -7,11 +7,11 @@ struct X { > > > > template > > struct S { > > - const X x; > > + const X x; // { dg-message "originally declared" } > > constexpr S(int) : x{} > > { > > const_cast(x).i =3D 19; // { dg-error "modifying a const obje= ct" } > > } > > }; > > > > -constexpr S p =3D { 10 }; // { dg-message "originally declared" } > > +constexpr S p =3D { 10 }; > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const3.C b/g= cc/testsuite/g++.dg/cpp1y/constexpr-tracking-const3.C > > index 6853775c1e2..fc88dd05eef 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const3.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const3.C > > @@ -7,7 +7,7 @@ struct A { > > }; > > > > struct B { > > - const A a; > > + const A a; // { dg-message "originally declared" } > > constexpr B(bool b) { > > if (b) > > const_cast(a).n =3D 3; // { dg-error "modifying a const ob= ject" } > > @@ -18,5 +18,4 @@ constexpr B b(false); > > static_assert(b.a.n =3D=3D 2, ""); > > > > constexpr B b2(true); // { dg-message "in .constexpr. expansion of " = } > > -// { dg-message "originally declared" "" { target *-*-* } .-1 } > > static_assert((b2.a.n, 1), ""); > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const4.C b/g= cc/testsuite/g++.dg/cpp1y/constexpr-tracking-const4.C > > index 8263a7cc505..27fede152c7 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const4.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const4.C > > @@ -2,7 +2,7 @@ > > // { dg-do compile { target c++14 } } > > > > struct A { > > - const int n; > > + const int n; // { dg-message "originally declared" } > > constexpr A() : n(1) { } > > }; > > struct B { > > @@ -13,5 +13,4 @@ struct B { > > } > > }; > > constexpr B b; // { dg-message "in .constexpr. expansion of " } > > -// { dg-message "originally declared" "" { target *-*-* } .-1 } > > static_assert((b.a.n, 1), ""); > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const7.C b/g= cc/testsuite/g++.dg/cpp1y/constexpr-tracking-const7.C > > index 922e8ff126f..bea14b05602 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const7.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const7.C > > @@ -3,7 +3,7 @@ > > > > struct D { int n; }; > > > > -struct C { const D d; }; > > +struct C { const D d; }; // { dg-message "originally declared" } > > > > struct A { > > C c; > > @@ -19,5 +19,4 @@ struct B { > > }; > > > > constexpr B b{}; // { dg-message "in .constexpr. expansion of " } > > -// { dg-message "originally declared" "" { target *-*-* } .-1 } > > static_assert((b.a.c.d.n, 1), ""); > > diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C b/gcc/testsu= ite/g++.dg/cpp1y/constexpr-union5.C > > index 55fe9fa2f0b..3d76345d564 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-union5.C > > @@ -8,8 +8,8 @@ union U { > > }; > > > > constexpr int foo(U *up) { > > - up->a++; > > + up->a++; // { dg-error "accessing uninitialized member" } > > return {42}; > > } > > > > -extern constexpr U u =3D {}; // { dg-error "accessing uninitialized me= mber" } > > +extern constexpr U u =3D {}; // { dg-message "in .constexpr. expansion= " } > > diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68180.C b/gcc/testsuite/g++.d= g/cpp1y/pr68180.C > > index 9e6e5e984f9..8de1ef3936b 100644 > > --- a/gcc/testsuite/g++.dg/cpp1y/pr68180.C > > +++ b/gcc/testsuite/g++.dg/cpp1y/pr68180.C > > @@ -6,11 +6,11 @@ typedef float __attribute__( ( vector_size( 16 ) ) ) = float32x4_t; > > constexpr float32x4_t fill(float x) { > > float32x4_t v{0}; > > constexpr auto vs =3D sizeof(v)/sizeof(v[0]); > > - for (auto i=3D0U; i > + for (auto i=3D0U; i > + constexpr float32x4_t v =3D fill(1.f); // { dg-message "in .constexp= r. expansion of " } > > return x+v; > > } > > diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C b/gcc/tests= uite/g++.dg/cpp1z/constexpr-lambda6.C > > index 214d3821299..c46c2d4c7fe 100644 > > --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C > > +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C > > @@ -1,7 +1,7 @@ > > // Testcase from P0170R1 > > // { dg-do compile { target c++17 } } > > > > -auto monoid =3D [](auto v) { return [=3D] { return v; }; }; > > +auto monoid =3D [](auto v) { return [=3D] { return v; }; }; // { dg-e= rror "not usable in a constant expression" } > > auto add =3D [](auto m1) constexpr { > > auto ret =3D m1(); > > return [=3D](auto m2) mutable { > > @@ -22,7 +22,7 @@ int main() > > // member function call operator can not perform an lvalue-to-rvalu= e conversion > > // on one of its subobjects (that represents its capture) in a cons= tant > > // expression. > > - auto two =3D monoid(2); > > + auto two =3D monoid(2); // { dg-message "not declared .constexpr." = } > > if (!(two() =3D=3D 2)) __builtin_abort(); // OK, not a constant exp= ression. > > static_assert(add(one)(one)() =3D=3D two()); // { dg-error "|in .co= nstexpr. expansion of " } two() is not a constant expression > > static_assert(add(one)(one)() =3D=3D monoid(2)()); // OK > > diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C b/gcc/tests= uite/g++.dg/cpp1z/constexpr-lambda8.C > > index 84be68ab7f0..82351ff0c54 100644 > > --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C > > +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C > > @@ -4,11 +4,14 @@ > > auto Fwd =3D [](int (*fp)(int), auto a) { return fp(a); }; > > auto C =3D [](auto a) { return a; }; > > static_assert( Fwd(C ,3) =3D=3D 3); // OK > > + > > // No specialization of the function call operator template can be co= nstexpr > > // (because of the local static). > > auto NC =3D [](auto a) { static int s; return a; }; // { dg-error "st= atic" } > > -// { dg-message "operator int" "" { target *-*-* } .+1 } > > +// { dg-error "called in a constant expression" "" { target *-*-* } .-= 1 } > > + > > static_assert( Fwd(NC ,3) =3D=3D 3); // { dg-error "" } > > +// { dg-message "operator int" "" { target *-*-* } .-1 } > > > > // We look for the string "operator int" to check that we aren't tryi= ng to do > > // template pretty-printing in an expression; that gets incredibly un= wieldy > > diff --git a/gcc/testsuite/g++.dg/cpp2a/bit-cast11.C b/gcc/testsuite/g+= +.dg/cpp2a/bit-cast11.C > > index a3eb31bc6c7..760c9ca40b4 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/bit-cast11.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/bit-cast11.C > > @@ -28,7 +28,7 @@ f3 () > > { > > T t =3D { 1, 2 }; > > S s =3D __builtin_bit_cast (S, t); > > - return s.a[1] =3D=3D 0; > > + return s.a[1] =3D=3D 0; // { dg-error "accessing unin= itialized array element" } > > } > > > > constexpr bool > > @@ -52,12 +52,12 @@ f6 () > > { > > W t =3D { 1, 2 }; > > V s =3D __builtin_bit_cast (V, t); > > - return s.b.a[1] =3D=3D 1; > > + return s.b.a[1] =3D=3D 1; // { dg-error "accessing unin= itialized array element" } > > } > > > > constexpr bool a =3D f1 (); > > constexpr bool b =3D f2 (); > > -constexpr bool c =3D f3 (); // { dg-error "accessing uninitialized = array element" } > > -constexpr bool d =3D f4 (); > > +constexpr bool c =3D f3 (); // { dg-message "in .constexpr. expansi= on" } > > +constexpr bool d =3D f4 (); // { dg-message "in .constexpr. expansi= on" } > > constexpr bool e =3D f5 (); > > -constexpr bool f =3D f6 (); // { dg-error "accessing uninitialized = array element" } > > +constexpr bool f =3D f6 (); // { dg-message "in .constexpr. expansi= on" } > > diff --git a/gcc/testsuite/g++.dg/cpp2a/bit-cast12.C b/gcc/testsuite/g+= +.dg/cpp2a/bit-cast12.C > > index 9c699dd55f0..e205bc6a8c1 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/bit-cast12.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/bit-cast12.C > > @@ -33,7 +33,7 @@ f3 () > > { > > T t =3D { 1, 2 }; > > S s =3D __builtin_bit_cast (S, t); > > - return s.a[1] =3D=3D 0; > > + return s.a[1] =3D=3D 0; // { dg-error "accessing unin= itialized array element" } > > } > > > > constexpr bool > > @@ -57,12 +57,12 @@ f6 () > > { > > W t =3D { 1, 2 }; > > V s =3D __builtin_bit_cast (V, t); > > - return s.b.a[1] =3D=3D 1; > > + return s.b.a[1] =3D=3D 1; // { dg-error "accessing unin= itialized array element" } > > } > > > > constexpr bool a =3D f1 (); > > constexpr bool b =3D f2 (); > > -constexpr bool c =3D f3 (); // { dg-error "accessing uninitialized = array element" } > > -constexpr bool d =3D f4 (); > > +constexpr bool c =3D f3 (); // { dg-message "in .constexpr. expansi= on" } > > +constexpr bool d =3D f4 (); // { dg-message "in .constexpr. expansi= on" } > > constexpr bool e =3D f5 (); > > -constexpr bool f =3D f6 (); // { dg-error "accessing uninitialized = array element" } > > +constexpr bool f =3D f6 (); // { dg-message "in .constexpr. expansi= on" } > > diff --git a/gcc/testsuite/g++.dg/cpp2a/bit-cast14.C b/gcc/testsuite/g+= +.dg/cpp2a/bit-cast14.C > > index 5e185919be4..e0cc9a39702 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/bit-cast14.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/bit-cast14.C > > @@ -44,7 +44,7 @@ f5 () > > { > > T1 t =3D { 0, 0, 0, 0, 0, 0, 0 }; > > S s =3D __builtin_bit_cast (S, t); > > - unsigned char a =3D s.a; > > + unsigned char a =3D s.a; // { dg-error "accessing uninit= ialized member" } > > return true; > > } > > > > @@ -53,7 +53,7 @@ f6 () > > { > > T2 t =3D { 0, 0, 0, 0, 0, 0, 0 }; > > S s =3D __builtin_bit_cast (S, t); > > - unsigned char b =3D s.b; > > + unsigned char b =3D s.b; // { dg-error "accessing uninit= ialized member" } > > return true; > > } > > > > @@ -62,14 +62,14 @@ f7 () > > { > > T3 t =3D { 0, 0, 0, 0, 0, 0, 0 }; > > S s =3D __builtin_bit_cast (S, t); > > - unsigned char c =3D s.c; > > + unsigned char c =3D s.c; // { dg-error "accessing uninit= ialized member" } > > return true; > > } > > > > constexpr bool a =3D f1 (); > > constexpr bool b =3D f2 (); > > constexpr bool c =3D f3 (); > > -constexpr bool d =3D f4 (); > > -constexpr bool e =3D f5 (); // { dg-error "accessing uninitialized = member" } > > -constexpr bool f =3D f6 (); // { dg-error "accessing uninitialized = member" } > > -constexpr bool g =3D f7 (); // { dg-error "accessing uninitialized = member" } > > +constexpr bool d =3D f4 (); // { dg-message "in .constexpr. expansi= on" } > > +constexpr bool e =3D f5 (); // { dg-message "in .constexpr. expansi= on" } > > +constexpr bool f =3D f6 (); // { dg-message "in .constexpr. expansi= on" } > > +constexpr bool g =3D f7 (); // { dg-message "in .constexpr. expansi= on" } > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C b/gcc/testsui= te/g++.dg/cpp2a/constexpr-98122.C > > index 01bdfa5bd4d..b0c91d5ef97 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-98122.C > > @@ -9,7 +9,7 @@ bar () > > { > > V f { .b =3D 42 }; > > constexpr auto m =3D &V::a; > > - return (f.*m) =3D=3D 42; > > + return (f.*m) =3D=3D 42; // { dg-error "accessing 'V::a' member ins= tead of initialized 'V::b' member in constant expression" } > > } > > > > constexpr bool > > @@ -21,5 +21,5 @@ baz () > > } > > > > static_assert (bar (), ""); // { dg-error "non-constant condition for= static assertion" } > > - // { dg-error "accessing 'V::a' member in= stead of initialized 'V::b' member in constant expression" "" { target *-*-= * } .-1 } > > + // { dg-message "in .constexpr. expansion= " "" { target *-*-* } .-1 } > > static_assert (baz (), ""); > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic17.C b/gcc/tes= tsuite/g++.dg/cpp2a/constexpr-dynamic17.C > > index a26678e6ed7..28facf192df 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic17.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic17.C > > @@ -25,8 +25,7 @@ struct D : B, A { > > > > constexpr B::B(V* v, A* a) > > { > > - dynamic_cast(a); > > + dynamic_cast(a); // { dg-error "accessing uninitialized member" = } > > } > > > > -constexpr D d; // { dg-error "accessing uninitialized member" } > > -// { dg-message "in 'constexpr' expansion of" "" { target *-*-* } .-1 = } > > +constexpr D d; // { dg-message "in 'constexpr' expansion of" } > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C b/gcc/testsui= te/g++.dg/cpp2a/constexpr-init1.C > > index e56ecfed48a..b4e39b6f928 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init1.C > > @@ -52,11 +52,10 @@ constexpr int > > fn5 () > > { > > struct S { int a =3D 9; int b; } s; > > - return s.b; > > + return s.b; // { dg-error "accessing uninitialized member" } > > } > > > > -constexpr int b =3D fn5 (); // { dg-error "accessing uninitialized mem= ber" } > > -// { dg-message "in .constexpr. expansion of" "" { target *-*-* } .-1 = } > > +constexpr int b =3D fn5 (); // { dg-message "in .constexpr. expansion = of" } > > > > constexpr int > > fn6 () > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C b/gcc/testsui= te/g++.dg/cpp2a/constexpr-new12.C > > index 5a3d06a5fab..832782e1427 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new12.C > > @@ -17,11 +17,11 @@ struct B : A { > > constexpr int > > foo () > > { > > - A *a =3D new B (); > > + A *a =3D new B (); // { dg-message "allocated here" } > > a->a =3D 4; > > delete a; > > - int r =3D a->foo (); > > + int r =3D a->foo (); // { dg-error "constant expression" } > > return r; > > } > > > > -constexpr auto a =3D foo (); // { dg-error "constant expression" } > > +constexpr auto a =3D foo (); // { dg-message "in .constexpr. expansio= n" } > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C b/gcc/testsuit= e/g++.dg/cpp2a/constexpr-new3.C > > index 70b841208f8..3ba440fec53 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C > > @@ -45,11 +45,10 @@ constexpr bool > > f5 () > > { > > int *p =3D new int; // { dg-message "allocated here" } > > - return *p =3D=3D 1; > > + return *p =3D=3D 1; // { dg-error "the content of uniniti= alized storage is not usable in a constant expression" } > > } > > > > -constexpr auto v5 =3D f5 (); // { dg-error "the content of uninitial= ized storage is not usable in a constant expression" } > > - // { dg-message "in 'constexpr' expansion= of" "" { target *-*-* } .-1 } > > +constexpr auto v5 =3D f5 (); // { dg-message "in 'constexpr' expansi= on of" } > > > > constexpr bool > > f6 () > > @@ -57,11 +56,10 @@ f6 () > > int *p =3D new int (2); // { dg-message "allocated here= " } > > int *q =3D p; > > delete p; > > - return *q =3D=3D 2; > > + return *q =3D=3D 2; // { dg-error "use of allocated stora= ge after deallocation in a constant expression" } > > } > > > > -constexpr auto v6 =3D f6 (); // { dg-error "use of allocated storage= after deallocation in a constant expression" } > > - // { dg-message "in 'constexpr' expansion= of" "" { target *-*-* } .-1 } > > +constexpr auto v6 =3D f6 (); // { dg-message "in 'constexpr' expansi= on of" } > > > > constexpr int * > > f7 () > > diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit10.C b/gcc/testsuite/g= ++.dg/cpp2a/constinit10.C > > index b678788541e..d2c49c41f91 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/constinit10.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/constinit10.C > > @@ -11,15 +11,14 @@ struct S1 > > struct alignas(64) S2 > > { > > constexpr S2 () > > - : m_tabS1() > > + : m_tabS1() // { dg-error "used before its definition" } > > {} > > > > S1 m_tabS1[7]; > > }; > > > > constinit S2 objX; // { dg-error ".constinit. variable .objX. does no= t have a constant initializer" } > > -// { dg-error "used before its definition" "" { target *-*-* } .-1 } > > -// // { dg-message "in .constexpr. expansion of" "" { target *-*-* } .= -2 } > > +// { dg-message "in .constexpr. expansion of" "" { target *-*-* } .-1 = } > > > > constexpr S1::S1 () > > : m_i(14) > > diff --git a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C b/gc= c/testsuite/g++.dg/cpp2a/is-corresponding-member4.C > > index 6b74090306b..241e9976e8c 100644 > > --- a/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C > > +++ b/gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C > > @@ -14,8 +14,8 @@ is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noex= cept > > struct A { int a; }; > > struct B; > > constexpr int B::*n =3D nullptr; > > -constexpr auto a =3D std::is_corresponding_member (&A::a, n); // { dg= -error "invalid use of incomplete type 'struct B'" } > > -constexpr auto b =3D std::is_corresponding_member (n, &A::a); // { dg= -error "invalid use of incomplete type 'struct B'" } > > +constexpr auto a =3D std::is_corresponding_member (&A::a, n); // { dg= -message "in .constexpr. expansion of" } > > +constexpr auto b =3D std::is_corresponding_member (n, &A::a); // { dg= -message "in .constexpr. expansion of" } > > > > void > > foo (int B::*m) > > diff --git a/gcc/testsuite/g++.dg/ext/constexpr-vla2.C b/gcc/testsuite/= g++.dg/ext/constexpr-vla2.C > > index d4ea7c58c0d..e09a27af3de 100644 > > --- a/gcc/testsuite/g++.dg/ext/constexpr-vla2.C > > +++ b/gcc/testsuite/g++.dg/ext/constexpr-vla2.C > > @@ -4,7 +4,7 @@ > > constexpr int > > fn_bad (int n) > > { > > - __extension__ int a [n] =3D { 0 }; > > + __extension__ int a [n] =3D { 0 }; // { dg-error "array subscript" = } > > int z =3D a [0] + (n ? fn_bad (n - 1) : 0); // { dg-message "in .co= nstexpr. expansion of " } > > return z; > > } > > @@ -18,4 +18,4 @@ fn_ok (int n) > > } > > > > constexpr int i1 =3D fn_ok (3); > > -constexpr int i2 =3D fn_bad (3); // { dg-error "array subscript|in .co= nstexpr. expansion of " } > > +constexpr int i2 =3D fn_bad (3); // { dg-message "in .constexpr. expan= sion of " } > > diff --git a/gcc/testsuite/g++.dg/ext/constexpr-vla3.C b/gcc/testsuite/= g++.dg/ext/constexpr-vla3.C > > index 538b576a825..6f9daa1897f 100644 > > --- a/gcc/testsuite/g++.dg/ext/constexpr-vla3.C > > +++ b/gcc/testsuite/g++.dg/ext/constexpr-vla3.C > > @@ -4,11 +4,11 @@ > > constexpr int > > foo (int n) > > { > > - __extension__ int a[n] =3D { 1, 2, 3, 4, 5, 6 }; > > + __extension__ int a[n] =3D { 1, 2, 3, 4, 5, 6 }; // { dg-error "arra= y subscript" } > > int z =3D 0; > > for (int i =3D 0; i <=3D n; ++i) > > z +=3D a[i]; > > return z; > > } > > > > -constexpr int n =3D foo (3); // { dg-error "array subscript|in .conste= xpr. expansion of " } > > +constexpr int n =3D foo (3); // { dg-message "in .constexpr. expansion= of " } > > diff --git a/gcc/testsuite/g++.dg/ubsan/pr63956.C b/gcc/testsuite/g++.d= g/ubsan/pr63956.C > > index 3a1596e6e2e..6fd0b4f893e 100644 > > --- a/gcc/testsuite/g++.dg/ubsan/pr63956.C > > +++ b/gcc/testsuite/g++.dg/ubsan/pr63956.C > > @@ -56,12 +56,13 @@ fn3 (int a, int b) > > { > > if (b !=3D 2) > > a =3D a / b; // { dg-error "..7 / 0.. is not a constant expressio= n" } > > + // { dg-error "overflow in constant expression" "" { ta= rget *-*-* } .-1 } > > return a; > > } > > > > constexpr int k1 =3D fn3 (8, 4); > > constexpr int k2 =3D fn3 (7, 0); // { dg-message "in .constexpr. expa= nsion" } > > -constexpr int k3 =3D fn3 (INT_MIN, -1); // { dg-error "overflow in con= stant expression|in .constexpr. expansion of " } > > +constexpr int k3 =3D fn3 (INT_MIN, -1); // { dg-message "in .constexpr= . expansion of " } > > > > SA (k1 =3D=3D 2); > > > > @@ -100,13 +101,13 @@ constexpr int > > fn7 (const int *a, int b) > > { > > if (b !=3D 3) > > - return fn6 (*a, b); > > + return fn6 (*a, b); // { dg-error "null pointer" } > > return 7; > > } > > > > constexpr int n1 =3D 7; > > constexpr int n2 =3D fn7 (&n1, 5); > > -constexpr int n3 =3D fn7 ((const int *) 0, 8); // { dg-error "null po= inter|in .constexpr. expansion of " } > > +constexpr int n3 =3D fn7 ((const int *) 0, 8); // { dg-message "in .c= onstexpr. expansion of " } > > > > constexpr int > > fn8 (int i) > > @@ -122,15 +123,15 @@ constexpr int > > fn9 (int a, int b) > > { > > if (b !=3D 0) > > - return a + b; > > + return a + b; // { dg-error "overflow in constant expression" } > > return a; > > } > > > > constexpr int p1 =3D fn9 (42, 7); > > -constexpr int p2 =3D fn9 (__INT_MAX__, 1); // { dg-error "overflow in = constant expression|in .constexpr. expansion of " } > > +constexpr int p2 =3D fn9 (__INT_MAX__, 1); // { dg-message "in .conste= xpr. expansion of " } > > constexpr int p3 =3D fn9 (__INT_MAX__, -1); > > constexpr int p4 =3D fn9 (INT_MIN, 1); > > -constexpr int p5 =3D fn9 (INT_MIN, -1); // { dg-error "overflow in con= stant expression|in .constexpr. expansion of " } > > +constexpr int p5 =3D fn9 (INT_MIN, -1); // { dg-message "in .constexpr= . expansion of " } > > > > SA (p1 =3D=3D 49); > > SA (p3 =3D=3D __INT_MAX__ - 1); > > @@ -140,13 +141,13 @@ constexpr int > > fn10 (int a, int b) > > { > > if (b !=3D 0) > > - return a * b; > > + return a * b; // { dg-error "overflow in constant expression" } > > return a; > > } > > > > constexpr int q1 =3D fn10 (10, 10); > > -constexpr int q2 =3D fn10 (__INT_MAX__, 2); // { dg-error "overflow in= constant expression|in .constexpr. expansion of " } > > -constexpr int q3 =3D fn10 (INT_MIN, 2); // { dg-error "overflow in con= stant expression|in .constexpr. expansion of " } > > +constexpr int q2 =3D fn10 (__INT_MAX__, 2); // { dg-message "in .const= expr. expansion of " } > > +constexpr int q3 =3D fn10 (INT_MIN, 2); // { dg-message "in .constexpr= . expansion of " } > > constexpr int q4 =3D fn10 (-1, -1); > > > > SA (q1 =3D=3D 100); > > @@ -155,14 +156,14 @@ SA (q4 =3D=3D 1); > > constexpr int > > fn11 (double d) > > { > > - int i =3D d; > > + int i =3D d; // { dg-error "overflow in constant expression" } > > if (i !=3D 0) > > return i; > > return i * 2; > > } > > > > constexpr int r1 =3D fn11 (3.4); > > -constexpr int r2 =3D fn11 (__builtin_inf ()); // { dg-error "overflow = in constant expression|in .constexpr. expansion of " } > > +constexpr int r2 =3D fn11 (__builtin_inf ()); // { dg-message "in .con= stexpr. expansion of " } > > > > constexpr int > > fn12 (int i) > > diff --git a/libstdc++-v3/testsuite/25_algorithms/equal/constexpr_neg.c= c b/libstdc++-v3/testsuite/25_algorithms/equal/constexpr_neg.cc > > index 34ca5c4805c..fd89ac0e166 100644 > > --- a/libstdc++-v3/testsuite/25_algorithms/equal/constexpr_neg.cc > > +++ b/libstdc++-v3/testsuite/25_algorithms/equal/constexpr_neg.cc > > @@ -32,7 +32,7 @@ test01() > > return outa; > > } > > > > -static_assert(test01()); // { dg-error "outside the bounds" } > > +static_assert(test01()); // { dg-error "non-constant condition" } > > > > constexpr bool > > test02() > > @@ -44,7 +44,8 @@ test02() > > return outa; > > } > > > > -static_assert(test02()); // { dg-error "outside the bounds" } > > +static_assert(test02()); // { dg-error "non-constant condition" } > > > > -// { dg-prune-output "non-constant condition" } > > +// Errors occuring within internals: > > +// { dg-error "outside the bounds of array" "" { target *-*-* } 0 } > > // { dg-prune-output "in 'constexpr'" } > > diff --git a/libstdc++-v3/testsuite/26_numerics/gcd/105844.cc b/libstdc= ++-v3/testsuite/26_numerics/gcd/105844.cc > > index 5b6fea7b560..bc9b29bc39d 100644 > > --- a/libstdc++-v3/testsuite/26_numerics/gcd/105844.cc > > +++ b/libstdc++-v3/testsuite/26_numerics/gcd/105844.cc > > @@ -13,9 +13,11 @@ static_assert( std::gcd(LLONG_MIN, 2ull) =3D=3D 2 ); > > static_assert( std::gcd(2ull, LLONG_MIN) =3D=3D 2 ); > > > > // But |INT_MIN| cannot be represented in common_type i.e. = int. > > -constexpr int a =3D std::gcd(INT_MIN, 1); // { dg-error "overflow" } > > -constexpr int b =3D std::gcd(1, INT_MIN); // { dg-error "overflow" } > > +constexpr int a =3D std::gcd(INT_MIN, 1); // { dg-error "in .constexpr= ." } > > +constexpr int b =3D std::gcd(1, INT_MIN); // { dg-error "in .constexpr= ." } > > > > // And |LLONG_MIN| cannot be represented in long. > > -constexpr long long c =3D std::gcd(LLONG_MIN, 1); // { dg-error "overf= low" } > > -constexpr long long d =3D std::gcd(1, LLONG_MIN); // { dg-error "overf= low" } > > +constexpr long long c =3D std::gcd(LLONG_MIN, 1); // { dg-error "in .c= onstexpr." } > > +constexpr long long d =3D std::gcd(1, LLONG_MIN); // { dg-error "in .c= onstexpr." } > > + > > +// { dg-error "overflow" "" { target *-*-* } 0 } > > diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc b/libstdc= ++-v3/testsuite/26_numerics/lcm/105844.cc > > index d0e032e03e0..d853974f77e 100644 > > --- a/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc > > +++ b/libstdc++-v3/testsuite/26_numerics/lcm/105844.cc > > @@ -9,14 +9,16 @@ static_assert( std::lcm(INT_MIN, 1u) =3D=3D INT_MAX+1= u ); > > static_assert( std::lcm(1u, INT_MIN) =3D=3D INT_MAX+1u ); > > > > // But |INT_MIN| cannot be represented in common_type i.e. = int. > > -constexpr int a =3D std::lcm(INT_MIN, 1); // { dg-error "overflow" } > > -constexpr int b =3D std::lcm(1, INT_MIN); // { dg-error "overflow" } > > +constexpr int a =3D std::lcm(INT_MIN, 1); // { dg-error "in .constexpr= ." } > > +constexpr int b =3D std::lcm(1, INT_MIN); // { dg-error "in .constexpr= ." } > > > > // And the LCM of 50000 and 49999 cannot be represented in int. > > -constexpr int c =3D std::lcm(50000, 49999); // { dg-error "overflow" } > > -constexpr int d =3D std::lcm(49999, 50000); // { dg-error "overflow" } > > +constexpr int c =3D std::lcm(50000, 49999); // { dg-error "in .constex= pr." } > > +constexpr int d =3D std::lcm(49999, 50000); // { dg-error "in .constex= pr." } > > > > // Similarly for unsigned, but the diagnostic is a failed assertion i= nstead. > > -constexpr int e =3D std::lcm(500000u, 499999); // { dg-error "in 'cons= texpr'" } > > -constexpr int f =3D std::lcm(499999u, 500000); // { dg-error "in 'cons= texpr'" } > > +constexpr int e =3D std::lcm(500000u, 499999); // { dg-error "in .cons= texpr." } > > +constexpr int f =3D std::lcm(499999u, 500000); // { dg-error "in .cons= texpr." } > > + > > +// { dg-error "overflow" "" { target *-*-* } 0 } > > // { dg-error "unreachable" "" { target *-*-* } 0 } >