public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marek Polacek <mpolacek@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-4470] testsuite: Adjust dg-error for -fimplicit-constexpr
Date: Fri,  2 Dec 2022 20:07:52 +0000 (GMT)	[thread overview]
Message-ID: <20221202200752.B33263858D39@sourceware.org> (raw)

https://gcc.gnu.org/g:1998db0fa1f78e373c88daea8bb339d32b41e6aa

commit r13-4470-g1998db0fa1f78e373c88daea8bb339d32b41e6aa
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Dec 2 14:43:26 2022 -0500

    testsuite: Adjust dg-error for -fimplicit-constexpr
    
    Some of the new tests were failing with -fimplicit-constexpr.  This
    patch adjusts the expected diagnostic.  Tested with
    
    GXX_TESTSUITE_STDS=98,11,14,17,20,23 make check-c++ RUNTESTFLAGS="--target_board=unix\{,-fimplicit-constexpr\} dg.exp=spaceship-eq3.C"
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/constexpr-ex1.C: Adjust dg-error.
            * g++.dg/cpp23/constexpr-nonlit10.C: Adjust dg-warning.
            * g++.dg/cpp23/constexpr-nonlit11.C: Likewise.
            * g++.dg/cpp2a/spaceship-eq3.C: Add dg-error.

Diff:
---
 gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C      | 6 +++---
 gcc/testsuite/g++.dg/cpp23/constexpr-nonlit10.C | 4 ++--
 gcc/testsuite/g++.dg/cpp23/constexpr-nonlit11.C | 4 ++--
 gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C      | 1 +
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
index 48281a47784..383d38a42d4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
@@ -87,8 +87,8 @@ struct resource {
   }
 };
 constexpr resource f(resource d)
-{ return d; }                  // { dg-error "non-.constexpr." "" { target { { ! implicit_constexpr } && c++20_down } } }
-// { dg-error "non-.constexpr." "" { target c++23 } .-2 }
-constexpr resource d = f(9);   // { dg-message ".constexpr." "" { target { ! implicit_constexpr } } }
+{ return d; }                  // { dg-error "non-.constexpr." "" { target { { { ! implicit_constexpr } && c++20_down } || c++11_only } } }
+// { dg-error "non-.constexpr." "" { target { c++23 && { ! implicit_constexpr } } } .-2 }
+constexpr resource d = f(9);   // { dg-message ".constexpr." "" { target { { ! implicit_constexpr } || c++11_only } } }
 
 // 4.4 floating-point constant expressions
diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit10.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit10.C
index 48706f7b66e..31d4b873bbf 100644
--- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit10.C
+++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit10.C
@@ -11,13 +11,13 @@ struct NonLiteral {
 // C++23: It is possible to write a constexpr function for which no
 // invocation satisfies the requirements of a core constant expression.
 constexpr NonLiteral
-fn0 (int) // { dg-warning "invalid return type" }
+fn0 (int) // { dg-warning "invalid return type" "" { target { ! implicit_constexpr } } }
 {
   return NonLiteral{};
 }
 
 constexpr int
-fn1 (NonLiteral) // { dg-warning "invalid type" }
+fn1 (NonLiteral) // { dg-warning "invalid type" "" { target { ! implicit_constexpr } } }
 {
   return 42;
 }
diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit11.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit11.C
index a7114bc66cb..e08809f873c 100644
--- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit11.C
+++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit11.C
@@ -25,10 +25,10 @@ struct X {
 struct S {
   X x;
   // Calls a non-constexpr constructor X::X(int).
-  constexpr S(int i) : x(i) { } // { dg-warning "call to" }
+  constexpr S(int i) : x(i) { } // { dg-warning "call to" "" { target { ! implicit_constexpr } } }
   S(int, int) { }
   // Target constructor isn't constexpr.
-  constexpr S() : S(42, 42) { } // { dg-warning "call to" }
+  constexpr S() : S(42, 42) { } // { dg-warning "call to" "" { target { ! implicit_constexpr } } }
 };
 
 namespace N1 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C
index 69eaa7b9b20..246839f1f95 100644
--- a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C
@@ -9,6 +9,7 @@ struct D
   A i;
   bool operator==(const D& x) const = default; // { dg-error "A::operator==" "" { target c++20_down } }
   bool operator!=(const D& z) const = default; // { dg-error "D::operator==" "" { target c++20_down } }
+// { dg-error "called" "" { target { c++23 && implicit_constexpr } } .-1 }
 };
 
 constexpr D d{A()};

                 reply	other threads:[~2022-12-02 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221202200752.B33263858D39@sourceware.org \
    --to=mpolacek@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).