Opened 11 years ago
Closed 11 years ago
#5666 closed Patches (fixed)
is_class documented as yielding "true" for unions, but documentation contradicts that
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | Boost 1.48.0 | Component: | type_traits |
Version: | Boost 1.46.1 | Severity: | Problem |
Keywords: | Cc: |
Description
The is_class documentation at http://www.boost.org/doc/libs/1_46_1/libs/type_traits/doc/html/boost_typetraits/reference/is_class.html says
"Inherits: If T is a (possibly cv-qualified) class type then inherits from true_type, otherwise inherits from false_type"
This means that is_class shall be derived from true_type if T is an union, because an union is a class type. But the "Compiler Compatibility" section contains some really confusing text:
"Without (some as yet unspecified) help from the compiler, we cannot distinguish between union and class types, as a result this type will erroneously inherit from true_type for union types."
Attachments (3)
Change History (8)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Also at 9p4: "A union is a class defined with the class-key union; its members are public by default and it holds only one data member at a time (9.5)." and the remaining text of the spec.
comment:3 by , 11 years ago
Component: | Documentation → type_traits |
---|---|
Milestone: | To Be Determined → Boost 1.48.0 |
Owner: | changed from | to
Type: | Bugs → Patches |
C++0x FDIS explicitly excludes a union type for is_class
.
I attached a patch to sync with this.
by , 11 years ago
Attachment: | intrinsics_comments_fix.patch added |
---|
A patch for fixing comments in intrinsics.hpp
.
comment:4 by , 11 years ago
Similarly, is_empty.qbk
needs to be fixed (a patch attached).
I also fixed comments in intrinsics.hpp
accordingly.
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Even the cited standard paragraph states this:
3.9.2: "unions, which are classes capable of containing objects of different types at different times, 9.5;"