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++ / May 2004

Tip: Looking for answers? Try searching our database.

VC7.1: Parser bug with overloaded function templates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hendrik Schober - 30 Apr 2004 19:30 GMT
Hi,

VC7.1 compiles the following, however, CW9, GCC 3.4.0, and
Comeau reject it:

   #include <iostream>
   #include <typeinfo>

   class Test1 {};
   class Test2 {};
   class Test3 {};

   template< typename T >
   struct Cont { T t; };

   template< typename T >
   class TT { public: TT(T) {} };

   struct X {

     template< template<typename> class TT, typename T >
     static void f(const T& t)
     {
       std::cout << '\t' << typeid(t).name() << std::endl;
     }

     template< template<typename> class TT >
     static void f(const Test3& t)
     {
       std::cout << '\t' << typeid(t).name() << std::endl;
     }

     template< template<typename> class TT, typename T >
     static void f(const Cont<T>& c)
     {
       f<TT>( c.t );  // <== error here
     }

   };

   int main()
   {
     Cont<Test1> c1;
     Cont<Test2> c2;
     Cont<Test3> c3;

     X::f< TT, Test1 >(c1);
     X::f< TT, Test2 >(c2);
     X::f< TT, Test3 >(c3);

     return 0;
   }

I had to learn that the call marked with "error here"
is ambigous.

TIA,

Schobi

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

"Sometimes compilers are so much more reasonable than people."
 Scott Meyers
Carl Daniel [VC++ MVP] - 30 Apr 2004 20:41 GMT
> Hi,
>
> VC7.1 compiles the following, however, CW9, GCC 3.4.0, and
> Comeau reject it:

Whidbey accepts it as well.  I'll submit it as a bug report if no one beats
me to it.

-cd
Hendrik Schober - 03 May 2004 11:10 GMT
> > Hi,
> >
[quoted text clipped - 3 lines]
> Whidbey accepts it as well.  I'll submit it as a bug report if no one beats
> me to it.

 Thanks, Carl!

> -cd

 Schobi

Signature

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

"Sometimes compilers are so much more reasonable than people."
 Scott Meyers


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.