VC71 bug ? (partial template spezialization)

  • Thread starter Thread starter Markus Mauhart
  • Start date Start date
M

Markus Mauhart

Hi,


I get an unexpected complaint from the compiler:

--------------------------
enum E {e0,e1};

template <class tx ,E ty> struct A;
template <class tx> struct A <tx,e1> {};//OK

template <int tx ,E ty> struct B;
template <int tx> struct B <tx,e1> {};//OK

template <int& tx ,E ty> struct C;
template <int& tx> struct C <tx,e1> {};//error
//error C2755: 'C<T0,e1>' :
// non-type parameter of a partial specialization must be a simple identifier
--------------------------


Is this a compiler bug ?


Thanks,
Markus.
 
Markus said:
Hi,


I get an unexpected complaint from the compiler:

--------------------------
enum E {e0,e1};

template <class tx ,E ty> struct A;
template <class tx> struct A <tx,e1> {};//OK

template <int tx ,E ty> struct B;
template <int tx> struct B <tx,e1> {};//OK

template <int& tx ,E ty> struct C;
template <int& tx> struct C <tx,e1> {};//error
//error C2755: 'C<T0,e1>' :
// non-type parameter of a partial specialization must be a
simple identifier

Yes it is. Consider it reported.

-cd
 
Hello Markus,

Thanks for the reponse and feedback. I will report this problem (not
showing in newsgroup) to our web dev team.

Thanks again for participating the community.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Markus Mauhart" <[email protected]>
!Sender: "Markus Mauhart" <[email protected]>
!References: <uz#[email protected]>
<[email protected]>
!Subject: RE: VC71 bug ? (partial template spezialization)
!Date: Fri, 26 Sep 2003 07:58:58 -0700
!Lines: 31
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcOEPrav2MuQab8sStWF5nQNHBT1wA==
!Newsgroups: microsoft.public.dotnet.languages.vc
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:28779
!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!X-Tomcat-NG: microsoft.public.dotnet.languages.vc
!
!>Carl is right. This is a know issue of template
!programming in VC 7.1. The
!>compiler error in template code is caused by enum
!members being seen as
!>identifiers rather than constants. Our produce group is
!working on it and
!>will fix it in the latter vesion.
!>
!>Does that answer your question?
!
!Yes, thanks ! But your posting didnt appear on
!msnews.microsoft.com, nor on one of its mirrors, nor on
!google. Only by chance I got it now, and I saw this
!problem also with another recent thread; I hope your news
!admins can fix this.
!
!Meanwhile I found as workaround to replace CLASS& with
!CLASS*, e.g. with CLASS == int:
!template <int& tx ,E ty> struct C;
!template <int& tx> struct C <tx,e1> {};//error
!template <int* tx ,E ty> struct D;
!template <int* tx> struct D <tx,e1> {};//OK
!
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!
!
!Thanks,
!Markus.
!
!
 
Back
Top