This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This is ill-formed. For two reasonsHi, When I compile the below code using gcc 3.3 I get the errors as below. But MS VC++ compiles it straight. Can any one please tell me what the problem is?
Thanks, Yogesh
namespace xyz { template<class A, class B, class C> class ABC { template<bool T> struct M { float a,b,c; }; template<> struct M<true> -> Error here { int i,j,k; }; }; };
1) [14.7.3]/2 says an explicit specialization of a member template shall be declared in the namespace of the enclosing class. I.e. you have to move the M<true> specialization out.
2) [14.7.3]/18 says that an explicit specialization of a member class template of a templated class must also specialize the outer class. I.e. you cannot put a specialized class inside a non-specialized class.
nathan -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |