aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-06-12 21:44:10 -0400
committerJason Merrill <jason@redhat.com>2024-06-13 11:06:14 -0400
commit8878fecc251762bc32c24e659695557797e03fd9 (patch)
treeb2e404ed062b060ceb727fe7f7393dd5dfca0a70 /gcc/testsuite/g++.dg
parent57113e3db168e19c46ca52ad084790d462eea603 (diff)
downloadgcc-8878fecc251762bc32c24e659695557797e03fd9.zip
gcc-8878fecc251762bc32c24e659695557797e03fd9.tar.gz
gcc-8878fecc251762bc32c24e659695557797e03fd9.tar.bz2
c++/modules: multiple usings of the same decl [PR115194]
add_binding_entity creates an OVERLOAD to represent a using-declaration in module purview of a declaration in the global module, even for non-functions, and we were failing to merge that with the original declaration in name lookup. It's not clear to me that building the OVERLOAD is what should be happening, but let's work around it for now pending an overhaul of using-decl handling for c++/114683. PR c++/115194 gcc/cp/ChangeLog: * name-lookup.cc (name_lookup::process_module_binding): Strip an OVERLOAD from a non-function. gcc/testsuite/ChangeLog: * g++.dg/modules/using-23_a.C: New test. * g++.dg/modules/using-23_b.C: New test.
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/modules/using-23_a.C19
-rw-r--r--gcc/testsuite/g++.dg/modules/using-23_b.C7
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/modules/using-23_a.C b/gcc/testsuite/g++.dg/modules/using-23_a.C
new file mode 100644
index 0000000..e7e6fec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/using-23_a.C
@@ -0,0 +1,19 @@
+// PR c++/115194
+// { dg-additional-options "-fmodules-ts -Wno-global-module" }
+
+module;
+
+namespace NS1 {
+ namespace NS2 {
+ class Thing {};
+ } // NS2
+ using NS2::Thing;
+} // NS1
+
+export module modA;
+
+export
+namespace NS1 {
+ using ::NS1::Thing;
+ namespace NS2 { }
+}
diff --git a/gcc/testsuite/g++.dg/modules/using-23_b.C b/gcc/testsuite/g++.dg/modules/using-23_b.C
new file mode 100644
index 0000000..6502c47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/using-23_b.C
@@ -0,0 +1,7 @@
+// { dg-additional-options "-fmodules-ts" }
+
+import modA;
+
+using NS1::Thing;
+using namespace NS1::NS2;
+Thing thing;