Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualWashu

Posted 23 October 2012 - 01:55 PM


anonymous structures within an anonymous union are not legal C++. Its a visual studio extension.


Crap, I've been looking the standard up and down and I didn't find anything that would make this illegal. Though I could've looked harder. Maybe there's a difference between C11 and C++11 in this regard? But I do know that it's not just a visual studio extension; it works well on gcc and clang as well.


C++98 - §9.5.2
[Note: nested types and functions cannot be declared within an anonymous union.]

C++11 - §9.5.5
[ Note: Nested types and functions cannot be declared within an anonymous union. —end note ]


#1Washu

Posted 23 October 2012 - 01:55 PM


anonymous structures within an anonymous union are not legal C++. Its a visual studio extension.


Crap, I've been looking the standard up and down and I didn't find anything that would make this illegal. Though I could've looked harder. Maybe there's a difference between C11 and C++11 in this regard? But I do know that it's not just a visual studio extension; it works well on gcc and clang as well.


C++98 - §9.2
[Note: nested types and functions cannot be declared within an anonymous union.]

C++11 - §9.5.5
[ Note: Nested types and functions cannot be declared within an anonymous union. —end note ]


PARTNERS