User account creation filtered due to spam.

Bug 24118 - Access control bug for base class of templates
Summary: Access control bug for base class of templates
Status: RESOLVED DUPLICATE of bug 16617
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: accepts-invalid
Depends on:
Reported: 2005-09-29 11:11 UTC by Richard Biener
Modified: 2009-04-29 07:05 UTC (History)
6 users (show)

See Also:
Known to work:
Known to fail: 3.3.5 3.4.4 4.0.1 4.1.0
Last reconfirmed: 2006-01-15 21:08:55


Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2005-09-29 11:11:32 UTC
struct Base
    typedef void (Base::*fnc)() const;
    void fnc_to_expose() const {}

template <typename T>
struct Derived : public Base
    fnc expose() { return &Base::fnc_to_expose; }
    fnc expose2() { return &Derived<T>::fnc_to_expose; }

void foo(void)
  Derived<int>  i;

does accept i.expose() which is invalid as can be seen by either using
a specialized version of Derived or using a non-template Derived.  It
should tell us In member function 'void (Base::* Class::expose())()const': error: 'void Base::fnc_to_expose() const' is protected error: within this context

as it does for those alternatives.
Comment 1 Wolfgang Bangerth 2005-09-29 16:29:28 UTC
Confirmed. Seems as if this never worked. 
Comment 2 Sumant Tambe 2009-04-26 18:19:40 UTC
Another similar access control related issue is bug #33934 (
Comment 3 Andrew Pinski 2009-04-29 07:05:41 UTC

*** This bug has been marked as a duplicate of 16617 ***