c++: Dependent using enum [PR97874]
authorJason Merrill <jason@redhat.com>
Wed, 27 Jan 2021 05:51:01 +0000 (00:51 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 27 Jan 2021 20:08:05 +0000 (15:08 -0500)
commit9cd7c32549fa334885b716fe98b674f6447fa7c0
treea75a9c54c180f5e49cceec4f6ec3e25cb248cb10
parent55163419211c6f17e3e22c68304384eba35782a3
c++: Dependent using enum [PR97874]

The handling of dependent scopes and unsuitable scopes in lookup_using_decl
was a bit convoluted; I tweaked it for a while and then eventually
reorganized much of the function to hopefully be clearer.  Along the way I
noticed a couple of ways we were mishandling inherited constructors.

The local binding for a dependent using is the USING_DECL.

Implement instantiation of a dependent USING_DECL at function scope.

gcc/cp/ChangeLog:

PR c++/97874
* name-lookup.c (lookup_using_decl): Clean up handling
of dependency and inherited constructors.
(finish_nonmember_using_decl): Handle DECL_DEPENDENT_P.
* pt.c (tsubst_expr): Handle DECL_DEPENDENT_P.

gcc/testsuite/ChangeLog:

PR c++/97874
* g++.dg/lookup/using4.C: No error in C++20.
* g++.dg/cpp0x/decltype37.C: Adjust message.
* g++.dg/template/crash75.C: Adjust message.
* g++.dg/template/crash76.C: Adjust message.
* g++.dg/cpp0x/inh-ctor36.C: New test.
* g++.dg/cpp1z/inh-ctor39.C: New test.
* g++.dg/cpp2a/using-enum-7.C: New test.
gcc/cp/name-lookup.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/decltype37.C
gcc/testsuite/g++.dg/cpp0x/inh-ctor36.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/inh-ctor39.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/using-enum-7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/using4.C
gcc/testsuite/g++.dg/template/crash75.C
gcc/testsuite/g++.dg/template/crash76.C