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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -