diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 9c7a9a962289ff5395d319da77ae7eb280e42a7b..b0cd1b463c82a5f918ca32ac237dde6d7e784082 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -30939,7 +30939,7 @@ cp_parser_type_requirement (cp_parser *parser) cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false); cp_parser_nested_name_specifier_opt (parser, /*typename_keyword_p=*/true, - /*check_dependency_p=*/false, + /*check_dependency_p=*/true, /*type_p=*/true, /*is_declaration=*/false); @@ -30949,7 +30949,7 @@ cp_parser_type_requirement (cp_parser *parser) cp_lexer_consume_token (parser->lexer); type = cp_parser_template_id (parser, /*template_keyword_p=*/true, - /*check_dependency=*/false, + /*check_dependency_p=*/true, /*tag_type=*/none_type, /*is_declaration=*/false); type = make_typename_type (parser->scope, type, typename_type, diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires35.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires35.C new file mode 100644 index 0000000000000000000000000000000000000000..7023019ea418a35c1736fd886057fe002bbdd2e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires35.C @@ -0,0 +1,27 @@ +// PR c++/110927 +// { dg-do compile { target c++20 } } + +template<class T> +struct A { + template<class U> struct B { using type = B; }; + template<class U> using type = U; +}; + +template<> struct A<void> { }; + +template<class T> +concept C1 = requires { typename A<T>::template B<bool>::type; }; + +template<class T> +concept C2 = requires { typename A<T>::template B<bool>; }; + +template<class T> +concept C3 = requires { typename A<T>::template type<bool>; }; + +static_assert(C1<int>); +static_assert(C2<int>); +static_assert(C3<int>); + +static_assert(!C1<void>); +static_assert(!C2<void>); +static_assert(!C3<void>);