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
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2005-09-29 11:11 UTC by Richard Biener
Modified: 2009-04-29 07:05 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
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


Attachments

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
{
  protected:
    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;
  i.expose();
  i.expose2();
}

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

 ex.cc: In member function 'void (Base::* Class::expose())()const':
 ex.cc:13: error: 'void Base::fnc_to_expose() const' is protected
 ex.cc:54: 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. 
W. 
Comment 2 Sumant Tambe 2009-04-26 18:19:40 UTC
Another similar access control related issue is bug #33934 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33934)
Comment 3 Andrew Pinski 2009-04-29 07:05:41 UTC

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