aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2021-01-21 04:48:39 -0800
committerNathan Sidwell <nathan@acm.org>2021-01-21 04:54:43 -0800
commit3c1cf7350bff6ba03faaa61b44d74bf8a06c6543 (patch)
treef8236d78d111f94f165eafce0e8981ac633f3f1d /gcc/cp
parenta1a967ce1ffe17cc6e6afaf76655314ab07a8de1 (diff)
downloadgcc-3c1cf7350bff6ba03faaa61b44d74bf8a06c6543.zip
gcc-3c1cf7350bff6ba03faaa61b44d74bf8a06c6543.tar.gz
gcc-3c1cf7350bff6ba03faaa61b44d74bf8a06c6543.tar.bz2
c++: Stat-hack for members [PR 98530]
This was a header file that deployed the stat-hack inside a class (both a member-class and a [non-static data] member had the same name). Due to the way that's represented in name lookup we missed the class. Sadly just changing the representation globally has detrimental effects elsewhere, and this is a rare case, so just creating a new overload on the fly shouldn't be a problem. PR c++/98530 gcc/cp/ * name-lookup.c (lookup_class_binding): Rearrange a stat-hack. gcc/testsuite/ * g++.dg/modules/stat-mem-1.h: New. * g++.dg/modules/stat-mem-1_a.H: New. * g++.dg/modules/stat-mem-1_b.C: New.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/name-lookup.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 843e5f3..0fb0036 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3926,11 +3926,16 @@ lookup_class_binding (tree klass, tree name)
vec<tree, va_gc> *member_vec = CLASSTYPE_MEMBER_VEC (klass);
found = member_vec_binary_search (member_vec, name);
- if (IDENTIFIER_CONV_OP_P (name))
+ if (!found)
+ ;
+ else if (STAT_HACK_P (found))
+ /* Rearrange the stat hack so that we don't need to expose that
+ internal detail. */
+ found = ovl_make (STAT_TYPE (found), STAT_DECL (found));
+ else if (IDENTIFIER_CONV_OP_P (name))
{
gcc_checking_assert (name == conv_op_identifier);
- if (found)
- found = OVL_CHAIN (found);
+ found = OVL_CHAIN (found);
}
}
else