https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77939
Bug ID: 77939 Summary: Valid program rejected due to access control Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ambrop7 at gmail dot com Target Milestone: --- The following C++ program cannot be compiled, which is valid to my understanding. template <typename Dummy> class Test { struct CatDog { static void meow () { CrazyHouse::TheCatDog::meow(); } struct Dog { static void bark (); }; }; struct CrazyHouse { using TheCatDog = CatDog; static void startMadness () { TheCatDog::meow(); TheCatDog::Dog::bark(); } }; public: static void init () { CrazyHouse::startMadness(); } }; int main () { Test<void> t; t.init(); } The error is: In instantiation of 'static void Test<Dummy>::CatDog::meow() [with Dummy = void]': 19 : required from 'static void Test<Dummy>::CrazyHouse::startMadness() [with Dummy = void]' 27 : required from 'static void Test<Dummy>::init() [with Dummy = void]' 34 : required from here 6 : error: 'using TheCatDog = struct Test<void>::CatDog' is private within this context CrazyHouse::TheCatDog::meow(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 15 : note: declared private here using TheCatDog = CatDog; CatDog::meow() should have access to CatDog class because 1) CatDog::meow() is part of CatDog class, 2) CatDog::meow() is declared within the Test class. I believe the test case is minimal.