https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97942
--- Comment #1 from David Friberg <davveston at gmail dot com> --- Somewhat related, we may note that GCC accepts-valid the following program, say (D): class A { class B {}; }; template<typename T, typename U> struct S {}; template<typename U> struct S<A::B, U> {}; template<typename T> struct S<T, A::B> {}; int main() {} which is valid as per [temp.class.spec]/10 (https://timsong-cpp.github.io/cppwp/n4861/temp.class.spec#10), which covers waiving of access checking for template arguments in the simple-template-id of partial specializations, a paragraph that was also added as part of P0692R1.