c++ - Friendship and private nested class inheritance -
i'd inherit nested class, in private section of outer class. possible?
class { friend class b; friend class c; private: class nicenestedclass { }; }; class c { void a() { a::nicenestedclass works; } }; class b : a::nicenestedclass{ };
instantiation of nicenestedclass not problem. g++ not allow me inherit it. there workaround?
g++ -std=c++11 a.c -o a.c:5:11: error: ‘class a::nicenestedclass’ private class nicenestedclass { ^ a.c:15:14: error: within context class b : a::nicenestedclass{
g++ 4.8.4, std=c++11
this known gcc bug reported in 2013
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59482
your code correct , should compile newer versions of gcc (fixed on gcc4.9 , later). on side (gcc5.3) works fine.
Comments
Post a Comment