https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71377

            Bug ID: 71377
           Summary: SFINAE expression compiles, but it should not because
                    of 14.5.5p8
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michele.caini at gmail dot com
  Target Milestone: ---

Consider the following code:

    #include <type_traits>
    #include <cstddef>

    template<std::size_t N, std::size_t M, std::enable_if_t<not (N>M)>* =
nullptr>
    struct S: public S<N+1, M> { };

    template<std::size_t N>
    struct S<N, N> { };

    int main() {
        S<0, 1> c{};
    }

I thought erroneously it is a clang bug, for it refused to compile it.
Instead, it seems to be a bug of GCC that accepts to compile it.
The code should be rejected because of 14.5.5p8:
http://eel.is/c++draft/temp.class.spec#8

This is the discussion on stackoverflow from which I got the ref to the
standard (thanks to the one that pointed my mistake out):
http://stackoverflow.com/a/37579096/4987285

Reply via email to