extendedAnonymousUnions Language Option (C++)

Syntax: Default:
lang(extendedAnonymousUnions[, yes])
lang(extendedAnonymousUnions, no)
lang(extendedAnonymousUnions[, yes])

This option controls what members are allowed in anonymous unions.

When this option is set to yes, anonymous unions can have members of all types that standard C++ allows in non-anonymous unions. For example, non-data members, such as structs, typedefs, and enumerations are allowed.

Member functions, virtual functions, or objects of classes that have non-trivial default constructors, copy constructors, or destructors cannot be members of a union, regardless of the setting of this option.

By default, VisualAge C++ allows non-data members in anonymous unions. This is an extension to standard C++ and gives behavior that is compatible with the C++ compilers provided by previous versions of VisualAge C++ and predecessor products, and Microsoft Visual C++.

When this option is set to yes, you receive a warning if your code uses the extension, unless you suppress the message with report(disable, "CPPC1608").

Set extendedAnonymousUnions to no for compliance with standard C++.



Incremental C++ Build
Configuration Files


Set Build Options
Build


Language Options for C++
Build Options
Build Options for Compliance With the C++ Standard
Build Options for Compatibility with Old C++ Compilers