From: David Malcolm <dmalcolm@redhat.com>
To: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [PATCH] c++: use "C++20" in std header hints
Date: Tue, 18 Feb 2020 01:14:00 -0000 [thread overview]
Message-ID: <20200218011439.8609-1-dmalcolm@redhat.com> (raw)
In-Reply-To: <20200215212149.26959-1-jason@redhat.com>
On Sat, 2020-02-15 at 22:21 +0100, Jason Merrill wrote:
> It's probably past time for this, but definitely now that we're done
> with
> the final committee meeting of C++20. This patch only adds the
> option and
> adjusts the testsuite to recognize it; more extensive changes can
> wait for
> the published standard.
I don't know if this is premature, or too piecemeal, but this patch
improves hints such as:
note: 'std::source_location' is only available from C++2a onwards
to
note: 'std::source_location' is only available from C++20 onwards
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
OK for master?
gcc/cp/ChangeLog:
* name-lookup.c (get_cxx_dialect_name): Return "C++20" for cxx2a.
gcc/testsuite/ChangeLog:
* g++.dg/lookup/missing-std-include-8.C: Add test coverage for
C++20 hints.
---
gcc/cp/name-lookup.c | 2 +-
gcc/testsuite/g++.dg/lookup/missing-std-include-8.C | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e5638d2df91..7a87c3d2eb5 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5856,7 +5856,7 @@ get_cxx_dialect_name (enum cxx_dialect dialect)
case cxx17:
return "C++17";
case cxx2a:
- return "C++2a";
+ return "C++20";
}
}
diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
index 73532c82968..716479761b4 100644
--- a/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
+++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-8.C
@@ -43,6 +43,10 @@ std::shared_timed_mutex m; // { dg-error "'shared_timed_mutex' in namespace 'std
std::string_view sv; // { dg-error "'string_view' in namespace 'std' does not name a type" }
// { dg-message "'std::string_view' is only available from C\\+\\+17 onwards" "" { target *-*-* } .-1 }
+/* Since C++20: */
+std::source_location loc; // { dg-error "'source_location' in namespace 'std' does not name a type" }
+// { dg-message "'std::source_location' is only available from C\\+\\+20 onwards" "" { target *-*-* } .-1 }
+
/* Verify interaction with "using namespace std;". */
using namespace std;
void test_via_using_directive ()
--
2.21.0
next prev parent reply other threads:[~2020-02-18 1:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-15 21:22 [committed] c++: Add -std=c++20 Jason Merrill
2020-02-18 1:14 ` David Malcolm [this message]
2020-02-19 23:55 ` [PATCH] c++: use "C++20" in std header hints Jason Merrill
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=20200218011439.8609-1-dmalcolm@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/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).