Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-985

[Linux/gcc] __is_base_of fails for private and protected inheritance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 4.3.0
    • 4.3.0
    • External
    • None
    • gcc-4.3

    • Incorrect Behavior

    Description

      The __is_base_of() helper provided with gcc-4.3 doesn't detect protected and private inheritance as required by the draft standard. It appears that the helper may be based on an older version of the standard and needs to be updated. Here is a note from the description of the is_base_of trait.

      [Note:Base classes that are private, protected, or ambigious are, nonetheless, base classes. —end note ]

      This is the gcc description of the helper that they provide..

      __is_base_of (base_type, derived_type)
      If base_type is a base class of derived_type ([class.derived]) then the trait is true, otherwise it is false. Top-level cv qualifications of base_type and derived_type are ignored. For the purposes of this trait, a class type is considered is own base. Requires: if __is_class (base_type) and __is_class (derived_type) are true and base_type and derived_type are not the same type (disregarding cv-qualifiers), derived_type shall be a complete type. Diagnostic is produced if this requirement is not met.

      Since there is no way to detect this from within the library, there isn't much we can do about fixing it.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vitek Travis Vitek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: