error ("%qD used without template arguments", name);
return error_mark_node;
}
+ else if (is_overloaded_fn (name))
+ {
+ if (complain & tf_error)
+ error ("%qD is a function, not a type", name);
+ return error_mark_node;
+ }
gcc_assert (identifier_p (name));
gcc_assert (TYPE_P (context));
error ("%q#T is not a class", context);
return error_mark_node;
}
-
+
/* When the CONTEXT is a dependent type, NAME could refer to a
dependent base class of CONTEXT. But look inside it anyway
if CONTEXT is a currently open scope, in case it refers to a
decl = cp_parser_maybe_treat_template_as_class (decl, class_head_p);
/* If this is a typename, create a TYPENAME_TYPE. */
- if (typename_p
- && decl != error_mark_node
- && !is_overloaded_fn (decl))
+ if (typename_p && decl != error_mark_node)
{
decl = make_typename_type (scope, decl, typename_type,
/*complain=*/tf_error);
template<typename T>
template<typename U>
-A<T>::A<U> () // { dg-error "partial specialization" }
+A<T>::A<U> () // { dg-error "" }
{
}
template<typename T>
template<typename U>
-B<T>::foo<int>(int) // { dg-error "partial specialization|declaration" }
+B<T>::foo<int>(int) // { dg-error "" }
{
return 1;
}
--- /dev/null
+// PR c++/99803
+// { dg-do compile { target c++20 } }
+
+struct A { template<typename T> A(T); };
+auto A(unsigned) -> A::template A<int>; // { dg-error "not a type" }