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: schaub.johannes@… 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)

is_class_documentation_fix.patch (565 bytes ) - added by Michel MORIN <mimomorin@…> 11 years ago.
A patch for is_class.qbk.
is_empty_documentation_fix.patch (522 bytes ) - added by Michel MORIN <mimomorin@…> 11 years ago.
A patch for is_empty.qbk.
intrinsics_comments_fix.patch (1.2 KB ) - added by Michel MORIN <mimomorin@…> 11 years ago.
A patch for fixing comments in intrinsics.hpp.

Download all attachments as: .zip

Change History (8)

comment:1 by Thomas Heller, 11 years ago

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;"

comment:2 by schaub.johannes@…, 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.

by Michel MORIN <mimomorin@…>, 11 years ago

A patch for is_class.qbk.

comment:3 by Michel MORIN <mimomorin@…>, 11 years ago

Component: Documentationtype_traits
Milestone: To Be DeterminedBoost 1.48.0
Owner: changed from Matias Capeletto to John Maddock
Type: BugsPatches

C++0x FDIS explicitly excludes a union type for is_class. I attached a patch to sync with this.

by Michel MORIN <mimomorin@…>, 11 years ago

A patch for is_empty.qbk.

by Michel MORIN <mimomorin@…>, 11 years ago

A patch for fixing comments in intrinsics.hpp.

comment:4 by Michel MORIN <mimomorin@…>, 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 John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [73942]) Documentation tweaks. Fixes #5666.

Note: See TracTickets for help on using tickets.