}
else if (nested_name_specifier)
{
- tree class_type;
+ type = TREE_TYPE (type);
/* Given:
we will get a TYPENAME_TYPE when processing the definition of
`S::T'. We need to resolve it to the actual type before we
try to define it. */
- if (TREE_CODE (TREE_TYPE (type)) == TYPENAME_TYPE)
+ if (TREE_CODE (type) == TYPENAME_TYPE)
{
- class_type = resolve_typename_type (TREE_TYPE (type),
- /*only_current_p=*/false);
- if (TREE_CODE (class_type) != TYPENAME_TYPE)
- type = TYPE_NAME (class_type);
- else
+ type = resolve_typename_type (type, /*only_current_p=*/false);
+ if (TREE_CODE (type) == TYPENAME_TYPE)
{
cp_parser_error (parser, "could not resolve typename type");
type = error_mark_node;
}
}
- if (maybe_process_partial_specialization (TREE_TYPE (type))
- == error_mark_node)
+ type = maybe_process_partial_specialization (type);
+ if (type == error_mark_node)
{
type = NULL_TREE;
goto done;
}
- class_type = current_class_type;
/* Enter the scope indicated by the nested-name-specifier. */
pushed_scope = push_scope (nested_name_specifier);
/* Get the canonical version of this type. */
- type = TYPE_MAIN_DECL (TREE_TYPE (type));
+ type = TYPE_MAIN_DECL (type);
/* Call push_template_decl if it seems like we should be defining a
template either from the template headers or the type we're
defining, so that we diagnose both extra and missing headers. */
--- /dev/null
+// PR c++/92944
+// { dg-do compile { target c++20 } }
+
+namespace ns { template<class T> struct A { }; }
+
+template<class T> requires true struct ns::A<T> { using type = T; };
+template<class T> requires false struct ns::A<T> { };
+
+template<class T> struct ns::A<T*> { };
+template<class T> requires true struct ns::A<T*> { using type = T; };
+template<class T> requires false struct ns::A<T*> { };
+
+using ty1 = ns::A<int>::type;
+using ty1 = int;
+
+using ty2 = ns::A<int*>::type;
+using ty2 = int;