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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -