Bug 65050 - gcc 3.1-1 accesses private typedef
Summary: gcc 3.1-1 accesses private typedef
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-16 19:21 UTC by Peter Klotz
Modified: 2007-04-18 16:42 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-02 20:11:00 UTC
Embargoed:


Attachments (Terms of Use)

Description Peter Klotz 2002-05-16 19:21:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0rc2)
Gecko/20020510

Description of problem:
Since the typedef in class Base is private, Base<T>::TT should be inaccessible
from class Derived.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.g++ -W -Wall main.cpp -o main
2../main
3.
	

Actual Results:  Compiles and runs.

Expected Results:  Should not compile.

Additional info:

#include <list>
#include <string>

template<typename T>
class Base
{
    typedef T TT;
};

template<typename T>
class Derived : public Base<T>
{
public:
    typedef typename Base<T>::TT TT;
    void f() { std::list<TT> l; }
};

int main(void)
{
    Derived<std::string>().f();
    return 0;
}

Comment 1 Peter Klotz 2003-10-19 11:23:15 UTC
You can close this bug report since gcc 3.3.x in Fedora handles the above code 
correctly.

Comment 2 Richard Henderson 2004-10-02 20:11:00 UTC
Indeed, fixed in gcc 3.3.


Note You need to log in before you can comment on or make changes to this bug.