+2018-02-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84557
+ * parser.c (cp_parser_omp_var_list_no_open): Only call
+ cp_parser_lookup_name_simple on names satisfying identifier_p.
+ (cp_parser_oacc_routine): Likewise.
+
2018-02-26 Jason Merrill <jason@redhat.com>
PR c++/84551 - ICE with concepts and -g.
if (name == error_mark_node)
goto skip_comma;
- decl = cp_parser_lookup_name_simple (parser, name, token->location);
+ if (identifier_p (name))
+ decl = cp_parser_lookup_name_simple (parser, name, token->location);
+ else
+ decl = name;
if (decl == error_mark_node)
cp_parser_name_lookup_error (parser, name, decl, NLE_NULL,
token->location);
/*template_p=*/NULL,
/*declarator_p=*/false,
/*optional_p=*/false);
- tree decl = cp_parser_lookup_name_simple (parser, name, name_loc);
+ tree decl = (identifier_p (name)
+ ? cp_parser_lookup_name_simple (parser, name, name_loc)
+ : name);
if (name != error_mark_node && decl == error_mark_node)
cp_parser_name_lookup_error (parser, name, decl, NLE_NULL, name_loc);
--- /dev/null
+// PR c++/84557
+// { dg-do compile }
+
+template<int> struct A {};
+template<int> struct B {};
+
+void
+foo ()
+{
+ #pragma omp parallel firstprivate (A) // { dg-error "is not a variable in clause" }
+ ;
+ #pragma omp parallel firstprivate (B<0>) // { dg-error "is not a variable in clause" }
+ ;
+}