Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

Possible template parser bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hendrik Schober - 23 Feb 2005 14:55 GMT
Hi,

this is a cut down version of some some template
meta stuff that I have:

///////////////////////////////////////////////////////
template< typename TL, typename TR >
struct Dummy1 {};

template< typename TL, typename TR
       , template<typename,typename> class TDummy >
struct Operation;

template< typename TL1, typename TL2
       , typename TR
       , template<typename,typename> class TDummy >
struct Operation< TDummy<TL1,TL2>
               , TR
               , TDummy > {
typedef TDummy<TL1,TL1> Result;
};

template< typename TL1, typename TL2
       , typename TR1, typename TR2
       , template<typename,typename> class TDummy >
struct Operation< TDummy<TL1,TL2>
               , TDummy<TR1,TR2>
               , TDummy > {
typedef TDummy<TL1,TL1> Result;
};

typedef Dummy1<int ,float > T1A;
typedef Dummy1<long,double> T1B;

typedef Operation< T1A , T1B , Dummy1 >::Result T3;
///////////////////////////////////////////////////////

Comeau and CodeWarrior 9 agree with me that this code
is fine. VC7.1, however, barks at me:

test.cpp(29) : error C2752: 'Operation<TL,TR,TDummy>' :
 more than one partial specialization matches the template argument list
test.cpp(24): could be 'Operation< TDummy<TL1,TL2>, TDummy<TR1,TR2>, TDummy >'
test.cpp(15): or       'Operation< TDummy<TL1,TL2>, TR, TDummy >'

I think this is a bug in VC7.1.
I cannot currently test this with VC8.

Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett

Carl Daniel [VC++ MVP] - 23 Feb 2005 15:27 GMT
> I think this is a bug in VC7.1.

I think you're right, but I haven't spent the time to really argue that
case.

> I cannot currently test this with VC8.

VC8 (Beta 1 Refresh) produces the same error messages as 7.1.

-cd
Hendrik Schober - 23 Feb 2005 19:38 GMT
> > I think this is a bug in VC7.1.
>
[quoted text clipped - 4 lines]
>
> VC8 (Beta 1 Refresh) produces the same error messages as 7.1.

 Interestingly, GCC agrees with VC here. (Which
 is rather rare IME. <g> )
 Nevertheless, due to experience I tend to trust
 Comeau and CW over VC and GCC.

> -cd

 Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett

Tom Widmer - 24 Feb 2005 10:18 GMT
>>>I think this is a bug in VC7.1.
>>
[quoted text clipped - 9 lines]
>   Nevertheless, due to experience I tend to trust
>   Comeau and CW over VC and GCC.

Yes, Comeau and CW are correct. The second partial specialization is
clearly more specialized than the first (you can synthesize types from
the first that the second can't match but not vice versa).

Tom
Hendrik Schober - 24 Feb 2005 20:22 GMT
> [...]
> Yes, Comeau and CW are correct. The second partial specialization is
> clearly more specialized than the first (you can synthesize types from
> the first that the second can't match but not vice versa).

 Thanks, Tom. That's what I figured, although
 I couldn't word it as good as you. :)
 I should report this then.

> Tom

 Schobi

Signature

SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.