location_t loc = type_specifier_seq.locations[ds_type_spec];
if (tree tmpl = CLASS_PLACEHOLDER_TEMPLATE (auto_node))
{
- error_at (loc, "missing template arguments after %qT",
- auto_node);
- inform (DECL_SOURCE_LOCATION (tmpl), "%qD declared here",
- tmpl);
+ if (!cp_parser_simulate_error (parser))
+ {
+ error_at (loc, "missing template arguments after %qT",
+ auto_node);
+ inform (DECL_SOURCE_LOCATION (tmpl), "%qD declared here",
+ tmpl);
+ }
}
else if (parser->in_template_argument_list_p)
error_at (loc, "%qT not permitted in template argument",
--- /dev/null
+// PR c++/87709
+// { dg-do compile { target c++17 } }
+
+template <class T>
+struct lit {
+ lit(T) { }
+};
+
+template <class T>
+int operator+(lit<T>, lit<T>) {
+ return 0;
+}
+
+auto r2 = (lit(0)) + lit(0);
+
+static_assert(sizeof(lit(0)));