[
https://issues.apache.org/jira/browse/STDCXX-985?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Travis Vitek closed STDCXX-985.
-------------------------------
Resolution: Cannot Reproduce
I'm not sure why I filed this now. The following testcase correctly detects
private and protected bases.
{noformat}
$ cat t.cpp; g++ t.cpp && ./a.out
struct B { };
struct D : private B { };
extern "C" int printf (const char*, ...);
int main ()
{
printf ("%u\n", __is_base_of(B, D));
return 0;
}
1
$
{noformat}
> [Linux/gcc] __is_base_of fails for private and protected inheritance
> --------------------------------------------------------------------
>
> Key: STDCXX-985
> URL: https://issues.apache.org/jira/browse/STDCXX-985
> Project: C++ Standard Library
> Issue Type: Bug
> Components: External
> Affects Versions: 4.3.0
> Environment: gcc-4.3
> Reporter: Travis Vitek
> Fix For: 4.3.0
>
>
> 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.
> {quote}[Note:Base classes that are private, protected, or ambigious are,
> nonetheless, base classes. —end note ]{quote}
> This is the gcc description of the helper that they provide..
> {quote}__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.{quote}
> Since there is no way to detect this from within the library, there isn't
> much we can do about fixing it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.