https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80951
Bug ID: 80951 Summary: Deducing noexcept only works when also deducing something else Product: gcc Version: 7.1.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rs2740 at gmail dot com Target Milestone: --- Another issue (compare bug 80384 and bug 80908) with the extension making noexcept(E) to be a deduced context (https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00665.html). The following works: void f() noexcept; template<bool E, class R> void g(R (*)() noexcept(E)); using t1 = decltype(g(f)); // OK But not when the only thing being deduced is E: template<bool E> void h(void (*)() noexcept(E)); using t2 = decltype(h(f)); // error <source>:12:24: error: no matching function for call to 'h(void (&)() noexcept)' using t2 = decltype(h(f)); // error ^ <source>:10:6: note: candidate: 'template<bool E> void h(void (*)() noexcept (E))' void h(void (*)() noexcept(E)); ^ <source>:10:6: note: template argument deduction/substitution failed: <source>:12:24: note: couldn't deduce template parameter 'E' using t2 = decltype(h(f)); // error ^ <source>:12:24: error: no matching function for call to 'h(void (&)() noexcept)' <source>:10:6: note: candidate: 'template<bool E> void h(void (*)() noexcept (E))' void h(void (*)() noexcept(E)); ^ <source>:10:6: note: template argument deduction/substitution failed: <source>:12:24: note: couldn't deduce template parameter 'E' using t2 = decltype(h(f)); // error ^