13461 – Fails to access protected-ctor from public constant (original) (raw)

| Description Die uwe Ysbeer 2003-12-22 10:30:17 UTC The following code compiles in all versions of g++ 3.2 and earlier that I tested. AFAIK this is legal C++ (unless I have missed some ru Comment 1 Die uwe Ysbeer 2003-12-22 11:47:52 UTC SOrry wrong example. The following one causes the prblem: template <typename T,typename Y> class C { public: typedef C<T,Y> self; static const self value; protected: C() {} }; template <typename T,typename Y> C<T,Y> const C<T,Y>::value; int main() { C<int,int> const& x= C<int,int>::value; } Comment 2 Kriang Lerdsuwanakij 2003-12-22 13:51:31 UTC This has just been fixed in the CVS and the fix will appear in future GCC 3.3.3 and GCC 3.4. | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |