public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/perf)] c++: implement C++20 Disambiguating Nested-Requirements (P2092R0)
@ 2020-03-19  5:59 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-03-19  5:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:117baab87711553e36074f624861c2d034af8b6c

commit 117baab87711553e36074f624861c2d034af8b6c
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Feb 28 17:39:42 2020 -0500

    c++: implement C++20 Disambiguating Nested-Requirements (P2092R0)
    
    The rule change in the title matches GCC's current behavior, so no change
    was needed.  But the paper also makes 'typename' optional in a
    requirement-parameter-list, so this implements that.
    
    gcc/cp/ChangeLog
    2020-02-28  Jason Merrill  <jason@redhat.com>
    
            Implement P2092R0, Disambiguating Nested-Requirements
            * parser.c (cp_parser_requirement_parameter_list): Pass
            CP_PARSER_FLAGS_TYPENAME_OPTIONAL.

Diff:
---
 gcc/cp/ChangeLog                            | 4 ++++
 gcc/cp/parser.c                             | 4 ++--
 gcc/testsuite/g++.dg/cpp2a/concepts-p2092.C | 8 ++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8a8de3237cd..4c87bde5d1c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
 2020-02-28  Jason Merrill  <jason@redhat.com>
 
+	Implement P2092R0, Disambiguating Nested-Requirements
+	* parser.c (cp_parser_requirement_parameter_list): Pass
+	CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
+
 	* call.c (build_user_type_conversion_1): Don't look at the second
 	conversion of a non-viable candidate.
 
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ca85d899427..24f71671469 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -27716,8 +27716,8 @@ cp_parser_requirement_parameter_list (cp_parser *parser)
   if (!parens.require_open (parser))
     return error_mark_node;
 
-  tree parms
-    = cp_parser_parameter_declaration_clause (parser, CP_PARSER_FLAGS_NONE);
+  tree parms = (cp_parser_parameter_declaration_clause
+		(parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL));
 
   if (!parens.require_close (parser))
     return error_mark_node;
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-p2092.C b/gcc/testsuite/g++.dg/cpp2a/concepts-p2092.C
new file mode 100644
index 00000000000..f293581a75a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-p2092.C
@@ -0,0 +1,8 @@
+// P2092R0
+// { dg-do compile { target concepts } }
+
+template <class T>
+concept Bar = requires (T::type t) { ++t; };
+
+template <class T>
+concept Foo = requires { requires { T(); }; }; // { dg-error "" }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-19  5:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  5:59 [gcc(refs/vendors/ibm/heads/perf)] c++: implement C++20 Disambiguating Nested-Requirements (P2092R0) Jiu Fu Guo

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).