https://gcc.gnu.org/g:9ab4d759125b0c7f040c6709d26175d89823ee02

commit r16-5260-g9ab4d759125b0c7f040c6709d26175d89823ee02
Author: Nathaniel Shead <[email protected]>
Date:   Fri Nov 14 09:11:25 2025 +1100

    c++/modules: Add testcase for lookup of hidden friend [PR122646]
    
    r16-5173-g52a24bcec9388a fixed this testcase, but I think it's
    worthwhile still adding this reduced test for it to the modules.exp set
    of tests so we don't need to rely on libstdc++ tests for it yet.
    
            PR c++/122646
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/modules/friend-10_a.C: New test.
            * g++.dg/modules/friend-10_b.C: New test.
    
    Signed-off-by: Nathaniel Shead <[email protected]>

Diff:
---
 gcc/testsuite/g++.dg/modules/friend-10_a.C | 21 +++++++++++++++++++++
 gcc/testsuite/g++.dg/modules/friend-10_b.C |  5 +++++
 2 files changed, 26 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/friend-10_a.C 
b/gcc/testsuite/g++.dg/modules/friend-10_a.C
new file mode 100644
index 000000000000..6669fffb9eab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/friend-10_a.C
@@ -0,0 +1,21 @@
+// PR c++/122646
+// { dg-additional-options "-fmodules -fconcepts" }
+// { dg-module-cmi M }
+
+export module M;
+
+template <typename T>
+struct zip_view_iterator {
+  void operator-(int) {}
+  friend void operator-(zip_view_iterator, zip_view_iterator)
+    requires requires(T x) { x.begin() - x.begin(); }
+  {}
+};
+
+struct ref_view {
+  ref_view begin();
+};
+
+export template <typename X> void foo() {
+  zip_view_iterator<ref_view>{} - X();
+}
diff --git a/gcc/testsuite/g++.dg/modules/friend-10_b.C 
b/gcc/testsuite/g++.dg/modules/friend-10_b.C
new file mode 100644
index 000000000000..ea261aa4939f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/friend-10_b.C
@@ -0,0 +1,5 @@
+// PR c++/122646
+// { dg-additional-options "-fmodules -fconcepts" }
+
+import M;
+template void foo<int>();

Reply via email to