https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91923
            Bug ID: 91923
           Summary: [9/10 Regression] Failure-to-SFINAE with class type
                    NTTP in C++17
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

Compiling this well-formed TU (https://godbolt.org/z/8HYWSC):

    template<typename T>
    constexpr bool is_integral_(...) {
        return false;
    }
    template<typename T, T = 1>
    constexpr bool is_integral_(long) {
        return true;
    }

    static_assert(is_integral_<int>(42));
    static_assert(!is_integral_<void>(42));

    struct S {};
    static_assert(!is_integral_<S>(42));

with -std=c++17 diagnoses:

    <source>: In substitution of 'template<class T, T <anonymous> > constexpr
bool is_integral_(long int) [with T = S; T <anonymous> = <missing>]':
    <source>:14:34:   required from here
    <source>:5:26: error: non-type template parameters of class type only
available with '-std=c++2a' or '-std=gnu++2a'
        5 | template<typename T, T = 1>
          |                          ^
    Compiler returned: 1

whereas earlier compiler versions (at least 6 though 8) accept the TU without
diagnostic.

This seems to simply be a case of adding the helpful new diagnostic but
forgetting to silence it in SFINAE context.

Reply via email to