re PR c++/84698 (ICE when using noexcept(noexcept()) declaration on global friend...
authorMarek Polacek <polacek@redhat.com>
Tue, 18 Jun 2019 21:50:51 +0000 (21:50 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 18 Jun 2019 21:50:51 +0000 (21:50 +0000)
PR c++/84698
* g++.dg/cpp0x/noexcept42.C: New test.

From-SVN: r272443

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/noexcept42.C [new file with mode: 0644]

index a348251..2848d2c 100644 (file)
@@ -1,5 +1,8 @@
 2019-06-18  Marek Polacek  <polacek@redhat.com>
 
+       PR c++/84698
+       * g++.dg/cpp0x/noexcept42.C: New test.
+
        PR c++/71548
        * g++.dg/cpp0x/variadic177.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept42.C b/gcc/testsuite/g++.dg/cpp0x/noexcept42.C
new file mode 100644 (file)
index 0000000..5d7218d
--- /dev/null
@@ -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;
+}