Note that the Concepts TS allows the auto or decltype(auto) to be
omitted in a constrained-type-specifier. */
-tree
+static tree
cp_parser_placeholder_type_specifier (cp_parser *parser, location_t loc,
tree tmpl, bool tentative)
{
args = TREE_OPERAND (tmpl, 1);
tmpl = TREE_OPERAND (tmpl, 0);
}
- if (args == NULL_TREE)
+ else
/* A concept-name with no arguments can't be an expression. */
tentative = false;
if (!flag_concepts_ts
|| !processing_template_parmlist)
{
- error_at (loc, "%qE does not constrain a type", DECL_NAME (con));
- inform (DECL_SOURCE_LOCATION (con), "concept defined here");
+ if (!tentative)
+ {
+ error_at (loc, "%qE does not constrain a type", DECL_NAME (con));
+ inform (DECL_SOURCE_LOCATION (con), "concept defined here");
+ }
return error_mark_node;
}
}
--- /dev/null
+// PR c++/98394
+// { dg-do compile { target c++20 } }
+
+template<int...>
+concept C = true;
+
+template<int, int>
+concept D = true;
+
+int main() {
+ if (C<1>); // { dg-bogus "does not constrain a type" }
+ if (D<1>); // { dg-error "wrong number of template arguments" }
+ // { dg-bogus "does not constrain a type" "" { target *-*-* } .-1 }
+}