aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2021-03-11 13:06:36 -0800
committerNathan Sidwell <nathan@acm.org>2021-03-11 13:13:12 -0800
commit5f27a9f90d4eadadf937f1a5d0bfccf39261f330 (patch)
treedda50bfbe17510a9b250fd099d548d20f16ccfe7
parent5643f6f396ef7f60d317aef07dd98978cec6afd0 (diff)
downloadgcc-5f27a9f90d4eadadf937f1a5d0bfccf39261f330.zip
gcc-5f27a9f90d4eadadf937f1a5d0bfccf39261f330.tar.gz
gcc-5f27a9f90d4eadadf937f1a5d0bfccf39261f330.tar.bz2
c++: Fix unhiding friend with imports [PR 99248]
This was a simple thinko about which object held the reference to the binding vector. I also noticed stale code in the tree dumper, as I recently removed the flags from a lazy number. PR c++/99248 gcc/cp/ * name-lookup.c (lookup_elaborated_type_1): Access slot not bind when there's a binding vector. * ptree.c (cxx_print_xnode): Lazy flags are no longer a thing. gcc/testsuite/ * g++.dg/modules/pr99248.h: New. * g++.dg/modules/pr99248_a.H: New. * g++.dg/modules/pr99248_b.H: New.
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/ptree.c3
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99248.h5
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99248_a.H5
-rw-r--r--gcc/testsuite/g++.dg/modules/pr99248_b.H7
5 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 28271ba..d8839e2 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -7940,7 +7940,7 @@ lookup_elaborated_type_1 (tree name, TAG_how how)
if (*slot == bind)
*slot = decl;
else
- BINDING_VECTOR_CLUSTER (bind, 0)
+ BINDING_VECTOR_CLUSTER (*slot, 0)
.slots[BINDING_SLOT_CURRENT] = decl;
}
}
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index e06fe6f..95a4fdf 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -310,8 +310,7 @@ cxx_print_xnode (FILE *file, tree node, int indent)
{
indent_to (file, indent + 4);
unsigned lazy = slot.get_lazy ();
- fprintf (file, "%s snum:%u flags:%d",
- pfx, lazy >> 2, lazy & 3);
+ fprintf (file, "%s snum:%u", pfx, lazy);
}
else if (slot)
print_node (file, pfx, slot, indent + 4);
diff --git a/gcc/testsuite/g++.dg/modules/pr99248.h b/gcc/testsuite/g++.dg/modules/pr99248.h
new file mode 100644
index 0000000..89d8dd5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99248.h
@@ -0,0 +1,5 @@
+class locale
+{
+ template<typename _Cache>
+ friend struct __use_cache;
+};
diff --git a/gcc/testsuite/g++.dg/modules/pr99248_a.H b/gcc/testsuite/g++.dg/modules/pr99248_a.H
new file mode 100644
index 0000000..7f3fdda
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99248_a.H
@@ -0,0 +1,5 @@
+// PR 99248 ICE with friend
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+#include "pr99248.h"
+
diff --git a/gcc/testsuite/g++.dg/modules/pr99248_b.H b/gcc/testsuite/g++.dg/modules/pr99248_b.H
new file mode 100644
index 0000000..33e242d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/pr99248_b.H
@@ -0,0 +1,7 @@
+// { dg-additional-options -fmodule-header }
+// { dg-module-cmi {} }
+#include "pr99248.h"
+import "pr99248_a.H";
+
+template<typename _Facet>
+struct __use_cache;