Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8282668

HotSpot Style Guide should permit unrestricted unions

XMLWordPrintable

    • b16

      C++11 introduced "unrestricted unions":
      http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf

      This removes some restrictions on the members of unions, making unions more powerful and more useful. (The paper also suggests it makes unions easier to use. For the new features that's perhaps somewhat in the eye of the beholder.)

      The primary change is that union data members are no longer restricted to types which don't have certain non-trivial special functions (constructors, destructor, copy constructor, copy assignment operator). The only remaining restriction on union data member types is that they can't be reference types. Named unions may also now have static members.

      To support this, the way implicitly declared special member functions for unions are changed, as is the implicit construction of data members.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: