https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96593
--- Comment #3 from gnzlbg <gonzalo.gadeschi at gmail dot com> --- >From 102444 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102444): See http://eel.is/c++draft/class.member.lookup#6 [class.member.lookup]/p6: "If it [the result of the search] differs from the result of a search in T for N from immediately after the class-specifier of T, the program is ill-formed, no diagnostic required." A class definition is not allowed to change the meaning of a name that was already used earlier in the class definition. While no diagnostic is required, I think a quality implementation like gcc should produce a diagnostic here and reject this program since it is ill-formed. Example (found in the wild): https://gcc.godbolt.org/z/jhEj68Kq8 struct plus { template<typename... Args> using invoke = void; }; template <typename Fn, typename... Args> using invoke = typename Fn::template invoke<Args...>; template <typename Fn> struct compose { template <typename X, typename Y> using F = invoke<Fn, X, Y>; template <typename X> using invoke = invoke<Fn, X, X>; }; using Q = compose<plus>::F<int, int>; Is accepted by gcc.