Another test that got fixed by my fix for member friend templates with
noexcept (r270005).  It's short and valid, so I'll add it too.

Tested x86_64-linux, applying to trunk.

2019-06-18  Marek Polacek  <pola...@redhat.com>

        PR c++/84698
        * g++.dg/cpp0x/noexcept42.C: New test.

diff --git gcc/testsuite/g++.dg/cpp0x/noexcept42.C 
gcc/testsuite/g++.dg/cpp0x/noexcept42.C
new file mode 100644
index 00000000000..5d7218dd3e0
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/noexcept42.C
@@ -0,0 +1,21 @@
+// PR c++/84698
+// { dg-do compile { target c++11 } }
+
+template<typename A, typename B>
+struct X {
+  void swap(X& o) noexcept { }
+
+  template<typename... Args>
+  friend void swap(X<Args...>& a, X<Args...>& b) noexcept(noexcept(a.swap(b)));
+};
+
+template<typename... Args>
+inline void swap(X<Args...>& a, X<Args...>& b) noexcept(noexcept(a.swap(b)))
+{
+}
+
+int
+main ()
+{
+  X<int, int> x;
+}

Reply via email to