diff options
author | Marek Polacek <polacek@redhat.com> | 2021-02-04 12:53:59 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-02-05 10:43:51 -0500 |
commit | 1cbc10d894494c34987d1f42f955e7843457ee38 (patch) | |
tree | 1a48393c2e2dc80343d456b718a56b522304efec /gcc/cfgexpand.c | |
parent | 6606b852bfa866c19375a7c5e9cb94776a28bd94 (diff) | |
download | gcc-1cbc10d894494c34987d1f42f955e7843457ee38.zip gcc-1cbc10d894494c34987d1f42f955e7843457ee38.tar.gz gcc-1cbc10d894494c34987d1f42f955e7843457ee38.tar.bz2 |
c++: Fix ICE with invalid using enum [PR96462]
Here we ICE in finish_nonmember_using_decl -> lookup_using_decl ->
... -> find_namespace_slot because "name" is not an IDENTIFIER_NODE.
It is a BIT_NOT_EXPR because this broken test uses
using E::~E; // SCOPE::NAME
A using-decl can't refer to a destructor, and lookup_using_decl already
checks that in the class member case. But in C++17, we do the "enum
scope is the enclosing scope" block, and so scope gets set to ::, and
we go into the NAMESPACE_DECL block. In C++20 we don't do it, we go
to the ENUMERAL_TYPE block.
I resorted to hoisting the check along with a diagnostic tweak: we
don't want to print "::::~E names destructor".
gcc/cp/ChangeLog:
PR c++/96462
* name-lookup.c (lookup_using_decl): Hoist the destructor check.
gcc/testsuite/ChangeLog:
PR c++/96462
* g++.dg/cpp2a/using-enum-8.C: New test.
Diffstat (limited to 'gcc/cfgexpand.c')
0 files changed, 0 insertions, 0 deletions