]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: add fixed test [PR115616]
authorMarek Polacek <polacek@redhat.com>
Fri, 30 Aug 2024 20:34:11 +0000 (16:34 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 30 Aug 2024 20:34:31 +0000 (16:34 -0400)
This got fixed by r15-2120.

PR c++/115616

gcc/testsuite/ChangeLog:

* g++.dg/template/friend83.C: New test.

gcc/testsuite/g++.dg/template/friend83.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/template/friend83.C b/gcc/testsuite/g++.dg/template/friend83.C
new file mode 100644 (file)
index 0000000..edd2961
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/115616
+// { dg-do compile { target c++20 } }
+
+template <int X, int Y> void bar() {}
+
+template <typename T>
+struct Reader
+{
+    template <int X>
+    friend void foo(Reader<T>);
+};
+
+template <typename T, int Y>
+struct Writer
+{
+    template <int X>
+    friend void foo(Reader<T>) {bar<X, Y>();}
+};
+
+int main()
+{
+    foo<10>(Reader<int>{});
+    Writer<int, 20>{};
+}