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 <pola...@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>();