From: Jason Merrill Date: Fri, 2 May 2025 13:33:39 +0000 (-0400) Subject: c++: fix some testcases X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7e77644d1b27810c5db1944644b6c5eca74cf93;p=thirdparty%2Fgcc.git c++: fix some testcases After r16-332 these tests started failing. constexpr-89285.C should have always given this error, and the new nonlit19.C needs to remove the destructor body to prevent -fimplicit-constexpr from making the testcase well-formed. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/constexpr-89285.C: Always diagnose reinterpret_cast. * g++.dg/cpp23/constexpr-nonlit19.C: Remove ~A body. --- diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C index efbf9bd15dd..d1aaecc1013 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-89285.C @@ -10,7 +10,7 @@ struct B { int *c = &x->a; while (*c) c = reinterpret_cast((reinterpret_cast(c) + *c)); - *c = reinterpret_cast(this) - reinterpret_cast(c); // { dg-error "reinterpret_cast" "" { target c++20_down } } + *c = reinterpret_cast(this) - reinterpret_cast(c); // { dg-error "reinterpret_cast" } } }; struct C : A { // { dg-error "" "" { target c++14_down } } diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit19.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit19.C index 1b73e2d8209..834dc631778 100644 --- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit19.C +++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit19.C @@ -1,6 +1,6 @@ // { dg-do compile { target c++23 } } -struct A { ~A() { } }; +struct A { ~A(); }; struct B { constexpr B() {