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

            Bug ID: 62072
           Summary: [4.9/4.10 regression] No SFINAE performed for function
                    type
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr

$ cat main.cpp
template<typename T> struct tuple_size {};
template<typename T> struct tuple_size<T const>: tuple_size<T> {};

template<typename T, typename = void>
struct query {
    static constexpr bool value = false;
};
template<typename T>
struct query<T, typename tuple_size<T>::type> {
    static constexpr bool value = true;
};

int main()
{
    // fine
    static_assert( !query<int>::value, "" );
    static_assert( !query<int const>::value, "" );

    // error: invalid use of incomplete type 'struct tuple_size<void()>'
    static_assert( !query<void()>::value, "" );
}
$ g++-trunk --version
g++-trunk (GCC) 4.10.0 20140809 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++-trunk -std=c++11 main.cpp
main.cpp: In instantiation of 'struct tuple_size<void()>':
main.cpp:20:34:   required from here
main.cpp:2:29: error: invalid use of incomplete type 'struct
tuple_size<void()>'
 template<typename T> struct tuple_size<T const>: tuple_size<T> {};
                             ^
main.cpp:2:29: note: declaration of 'struct tuple_size<void()>'

----------

The testcase compiles fine against GCC 4.8.2 and 4.9.0.

Reply via email to