aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/parser.cc2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-requires38.C14
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 598380d..6b786ed 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -31225,6 +31225,8 @@ cp_parser_constraint_primary_expression (cp_parser *parser, bool lambda_p)
}
if (pce == pce_ok)
{
+ if (idk == CP_ID_KIND_UNQUALIFIED && identifier_p (expr))
+ expr = unqualified_name_lookup_error (expr);
cp_lexer_commit_tokens (parser->lexer);
return finish_constraint_primary_expr (expr);
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires38.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires38.C
new file mode 100644
index 0000000..663195b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires38.C
@@ -0,0 +1,14 @@
+// PR c++/99678
+// { dg-do compile { target c++20 } }
+
+template<class T>
+void f1() requires undeclared_identifier; // { dg-error "not declared" }
+
+template<class T>
+void f2() requires true && undeclared_identifier; // { dg-error "not declared" }
+
+template<class T>
+void f3() requires false || undeclared_identifier; // { dg-error "not declared" }
+
+template<class T>
+void f4() requires undeclared_identifier(T{}); // { dg-error "must be enclosed in parentheses" }