template parameters are hidden by class members

From: Gianni Mariani (gi2nospam_at_mariani.ws)
Date: 02/02/04


Date: 02 Feb 2004 13:38:19 EST


I was a little surprised by this:

It seems like the code below should not compile but the Comeau 4.3.3
compiler accepts it and the gcc 3.4(prerel) compiler rejects it and
MSVC++7.1 ICE's.

14.6.1 in the standard seems to imply that template parameters are
hidden by class members.

struct X
{
     struct C { int x; };
     class Z { Z(int){} };

     template<typename T,typename A, template<typename,typename> class C>
     C<T, A> Func()
     {
         return C<T, A>(); // should find X::C which is not a template
     }

     template< typename Z > Z Zunc()
     {
         return Z(); //this is X::Z and fail on undefined constructor
     }

     template< typename Z > void Zinc()
     {
     }

     void tst()
     {
         Zunc<int>();

         Zinc<int>();
     }
};

Notch that up to another C++ lesson.



Relevant Pages

  • Re: Whats the story with the "end of XP"?
    ... Support gives them access to the larger body ... The same compiler suite may be "best" in both ... In the case of ByteCraft compilers, you are truly expert in your field, you work closely and rapidly with customers if there are any issues, and you have top class testing and quality control. ... understanding the inner workings of a relatively simple compiler like GCC ...
    (comp.arch.embedded)
  • Re: 10.0-CUR r226986 && ports (general)
    ... configure:3232: checking for gcc ... Configured with: FreeBSD/amd64 system compiler ... configure:5483: checking how to associate runtime and link libraries ... configure: failed program was: ...
    (freebsd-current)
  • [RFC][PATCH-2.6] Clean up and merge compiler-*.h
    ... the kernel headers in include/linux to include/linux-abi. ... * Common definitions for all gcc versions go here. ... -/* Some compiler specific definitions are overwritten here ...
    (Linux-Kernel)
  • Re: LPC900/80C51 Compiler Toolchain
    ... >> supported by GCC, and so they invest. ... > if they already have their in-house compiler. ... one of the main companies in the Symbian consortium ... vendor to provide a good compiler for Atmel AVRs and eventually became ...
    (comp.arch.embedded)
  • Re: [TESTING]: ClangBSD branch needs testing before the import to HEAD
    ... I hate gcc with the burning heat of a million suns. ... been a major liability towards FreeBSD releases in the past. ... While Clang is immature now, it will mature in the near future, ... Any bug analisys now shall start with exchange to verify which compiler ...
    (freebsd-current)