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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Valid variant:

template <bool> struct A;

struct B { static constexpr bool g = false; };

struct C {
  template <typename> static B c ();
};

template <class T> struct D : C {
  using c = decltype (c<T>());
  using E = A<c::g>;
};

D<int> g;

This is a complex interaction of issues.  Looking up c<T> in the definition of
D::c finds C::c, OK.  Looking up c in the definition of E finds D::c, which is
depedent, OK.  Since the alias is not dependent, we strip it from the template
argument, leaving

using E = A<decltype(c<T>())>;

where 'c' still refers to C::c.  But instantiating E looks up 'c' again and
finds D::c, which isn't a function, so things go wrong.

I think the bug here is looking up 'c' in D at instantiation time; the
declaration we found before is not dependent.

Reply via email to