]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: elaborated-type-spec in requires-expr [PR101677]
authorJason Merrill <jason@redhat.com>
Mon, 28 Mar 2022 02:31:51 +0000 (22:31 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 12 Apr 2022 20:12:49 +0000 (16:12 -0400)
commit556d061e62ea863c7f99129219ca69bf0792c7f1
tree48938add0bfeccb5d082e9d9e8038d196d3d833f
parent00e7d6e66638b8d2d93ff6659a140f8b3cf37aeb
c++: elaborated-type-spec in requires-expr [PR101677]

We were failing to declare class S in the global namespace because we were
treating the requires-expression parameter scope as a normal block scope, so
the implicit declaration went there.

It seems to me that the requires parameter scope is more like a function
parameter scope (not least in the use of the word "parameter"), so let's
change the scope kind.  But then we need to adjust the prohibition on
placeholders declaring implicit template parameters.

PR c++/101677

gcc/cp/ChangeLog:

* name-lookup.h (struct cp_binding_level): Add requires_expression
bit-field.
* parser.c (cp_parser_requires_expression): Set it.
(synthesize_implicit_template_parm): Check it.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-pr67178.C: Adjust error.
* g++.dg/cpp2a/concepts-requires28.C: New test.
gcc/cp/name-lookup.h
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp2a/concepts-pr67178.C
gcc/testsuite/g++.dg/cpp2a/concepts-requires28.C [new file with mode: 0644]