]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Add testcase for already fixed PR [PR104425]
authorPatrick Palka <ppalka@redhat.com>
Tue, 8 Feb 2022 14:47:34 +0000 (09:47 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 8 Feb 2022 14:47:34 +0000 (09:47 -0500)
Fixed by r12-1829.

PR c++/104425

gcc/testsuite/ChangeLog:

* g++.dg/template/partial-specialization10.C: New test.

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

diff --git a/gcc/testsuite/g++.dg/template/partial-specialization10.C b/gcc/testsuite/g++.dg/template/partial-specialization10.C
new file mode 100644 (file)
index 0000000..d03f313
--- /dev/null
@@ -0,0 +1,25 @@
+// PR c++/104425
+// { dg-do compile { target c++11 } }
+
+namespace A { class foo {}; }
+namespace B { class bar {}; }
+
+A::foo& operator<<(A::foo& f, const B::bar&);
+
+namespace C {
+  template<class T> T val();
+
+  A::foo& operator<<(A::foo& f, int in);
+
+  template<class T, class = void>
+  struct has_insertion_operator {
+    static constexpr bool value = false;
+  };
+
+  template<class T>
+  struct has_insertion_operator<T, decltype(val<A::foo&>() << val<T>(), void())> {
+    static constexpr bool value = true;
+  };
+}
+
+static_assert(!C::has_insertion_operator<B::bar>::value, "");