Message ID | 20200218011439.8609-1-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
Series | c++: use "C++20" in std header hints | expand |
On 2/18/20 2:14 AM, David Malcolm wrote: > 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? Why change this in just this one place? Jason
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 ()