c++/231: Not allowing use of private typedef for static initialization

matt_conway@i2.com matt_conway@i2.com
Mon May 22 18:06:00 GMT 2000


>Number:         231
>Category:       c++
>Synopsis:       Not allowing use of private typedef for static initialization
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon May 22 18:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     matt_conway@i2.com
>Release:        gcc snapshot 20000410
>Organization:
>Environment:

>Description:
compiling the following code with g++ produces the error:
priv-class.cpp:12: `typedef class Bar<int> Foo::FInt' is private
priv-class.cpp:16: within this context

I can't determine from the ISO C++ spec that this is illegal, but how else is one supposed to initialize a static member for a templated class used internal to another class?

template<class T>
class Bar
{
private:
	static T i;
};

class Foo
{
private:
	typedef Bar<int> FInt;
};


template<> int Foo::FInt::i = 1;
>How-To-Repeat:

>Fix:
temporarily expose the typedef to be public
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list