This adds a note suggesting to enable concepts whenever 'requires' is parsed as
an invalid type name with concepts disabled.
gcc/cp/ChangeLog:
* parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
concepts if the invalid identifier is 'requires'.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/diagnostic11.C: New test.
+2020-04-25 Patrick Palka <ppalka@redhat.com>
+
+ * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
+ concepts if the invalid identifier is 'requires'.
+
2020-04-25 Jakub Jelinek <jakub@redhat.com>
PR c++/94742
else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT])
inform (location, "%<concept%> only available with %<-std=c++2a%> or "
"%<-fconcepts%>");
+ else if (!flag_concepts && id == ridpointers[(int)RID_REQUIRES])
+ inform (location, "%<requires%> only available with %<-std=c++2a%> or "
+ "%<-fconcepts%>");
else if (processing_template_decl && current_class_type
&& TYPE_BINFO (current_class_type))
{
+2020-04-25 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/concepts/diagnostic11.C: New test.
+
2020-04-25 Jakub Jelinek <jakub@redhat.com>
PR c++/94742
--- /dev/null
+// { dg-do compile { target c++17_only } }
+
+template <bool B>
+ requires B // { dg-error ".requires. does not name a type" }
+// { dg-message ".requires. only available with" "" { target *-*-* } .-1 }
+void foo() { }