This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to add test for c++/89873
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 20 Jun 2019 08:23:53 -0400
- Subject: C++ PATCH to add test for c++/89873
I didn't realize my change r270319 had fixed this PR. So adding the test and
closing the PR.
Tested on x86_64-linux, applying to trunk.
2019-06-20 Marek Polacek <polacek@redhat.com>
PR c++/89873
* g++.dg/cpp1y/noexcept1.C: New test.
diff --git gcc/testsuite/g++.dg/cpp1y/noexcept1.C gcc/testsuite/g++.dg/cpp1y/noexcept1.C
new file mode 100644
index 00000000000..86e46c96148
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1y/noexcept1.C
@@ -0,0 +1,13 @@
+// PR c++/89873
+// { dg-do compile { target c++14 } }
+
+template <int> bool b;
+
+template <typename>
+struct C {
+ template <typename> friend int foo() noexcept(b<1>); // { dg-error "not usable in a constant expression|different exception specifier" }
+};
+
+template <typename> int foo() noexcept(b<1>);
+
+auto a = C<int>();