c++ - Initializing derived class enum with (unscoped) base class enum having the same name -
the following code (also on ideone) looks shouldn't compile on msvc 2008 , gcc 4.8.2
#include<iostream> struct base { enum state { on = 11 , off = 22 , standby = 33 }; }; struct derived : base { enum state { on = on , off = off }; // huh? }; int main() { std::cout << derived::on << std::endl; }
is standard compliant?
enum state { on = on , off = off }; // huh? ^^
at point derived re-definition not complete, on used base.
Comments
Post a Comment