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

            Bug ID: 86818
           Summary: injected-class-name interpreted as type instead of
                    constructor
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

From https://stackoverflow.com/q/51621560/2069064:

template <class> using void_t = void;

template <class C, class = void>
struct X {
    static constexpr bool value = false;
};

template <class C>
struct X<C, void_t<typename C::T> > {
    static constexpr bool value = true;
};

struct T { };
static_assert(!X<T>::value);

According to [class.qual], I think "typename C::T" should be considered to name
the constructor of C when C is T, so the assert should NOT trigger (because
typename C::T is not a type, so we fallback to the primary template). This
program compiles on clang, fails on gcc.

Reply via email to