diff options
-rw-r--r-- | gcc/cp/name-lookup.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/stat-mem-1.h | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/stat-mem-1_a.H | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/stat-mem-1_b.C | 4 |
4 files changed, 23 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 diff --git a/gcc/testsuite/g++.dg/modules/stat-mem-1.h b/gcc/testsuite/g++.dg/modules/stat-mem-1.h new file mode 100644 index 0000000..b5703ea --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/stat-mem-1.h @@ -0,0 +1,6 @@ + +struct fpu { + struct NAME { + int state; + } NAME; +}; diff --git a/gcc/testsuite/g++.dg/modules/stat-mem-1_a.H b/gcc/testsuite/g++.dg/modules/stat-mem-1_a.H new file mode 100644 index 0000000..6daa137 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/stat-mem-1_a.H @@ -0,0 +1,5 @@ +// { dg-additional-options -fmodule-header } +// PR c++ 98530 stat-hack inside a structure +// { dg-module-cmi {} } + +#include "stat-mem-1.h" diff --git a/gcc/testsuite/g++.dg/modules/stat-mem-1_b.C b/gcc/testsuite/g++.dg/modules/stat-mem-1_b.C new file mode 100644 index 0000000..9b83d4e --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/stat-mem-1_b.C @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodules-ts -fno-module-lazy" } + +#include "stat-mem-1.h" +import "stat-mem-1_a.H"; |