https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88815
Bug ID: 88815 Summary: [9 Regression] is_constexpr (based on narrowing conversion and expression SFINAE) broken Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: programmer at posteo dot de Target Milestone: --- [note: following code adopted from https://stackoverflow.com/a/50169108/2615118] The following experiment of an "is_constexpr" implementation fails on GCC 9. https://godbolt.org/z/xDiFet // BEGIN CODE struct true_type { constexpr operator bool() const { return true; } }; struct false_type { constexpr operator bool() const { return false; } }; template<int (*p)()> true_type is_constexpr_impl(decltype(int{(p(), 0U)}));// narrowing conversion template<int (*p)()> false_type is_constexpr_impl(...); template<int (*p)()> using is_constexpr = decltype(is_constexpr_impl<p>(0)); constexpr int f() { return 0; } int g() { return 0; } static_assert(is_constexpr<f>()); static_assert(!is_constexpr<g>());// this one fails in GCC 9.0.0 20190109 // END CODE