[gcc r12-7109] c++: Add testcase for already fixed PR [PR104425]

Patrick Palka ppalka@gcc.gnu.org
Tue Feb 8 14:49:09 GMT 2022


https://gcc.gnu.org/g:be862bf1f612c884597ace4cbfdec972a0bf0eef

commit r12-7109-gbe862bf1f612c884597ace4cbfdec972a0bf0eef
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Feb 8 09:47:34 2022 -0500

    c++: Add testcase for already fixed PR [PR104425]
    
    Fixed by r12-1829.
    
            PR c++/104425
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/template/partial-specialization10.C: New test.

Diff:
---
 .../g++.dg/template/partial-specialization10.C     | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/gcc/testsuite/g++.dg/template/partial-specialization10.C b/gcc/testsuite/g++.dg/template/partial-specialization10.C
new file mode 100644
index 00000000000..d03f313745b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial-specialization10.C
@@ -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, "");


More information about the Gcc-cvs mailing list