This is the mail archive of the gcc@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]

Re: typedef vs. typename confusion


I know typename was introduced to C++ to eliminate compilation
ambiguities (IIRC, whether it's a type name or a symbol name).  It
sounds like you have such a situation.  It'd probably be better if you
went through your templates and specified typename when necessary.

Noel

Fred Richardson wrote:
> 
> Hi-
> 
> I have some older template code (which is too big to paste here) which
> used to compile and run with egcs-1.0.3 but breaks with the following
> version of egcs off the 1.1 CVS branch:
> 
>   % gcc -v
>   Reading specs from /d4mutl/bybrad.dev/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.52/specs
>   gcc version egcs-2.91.52 19980802 (gcc2 ss-980609 experimental)
>   %
> 
> The problem I found is that if I neglect to use typename in certain
> places, the compiler will get confused and use a different (and on my
> part unspecified) set of template parameters (currently for or in a
> friend function) and complain that no match can be found for the
> function I'm calling.  Usually the function(s) it lists in the
> possible matches have parameters for classes that I never instantiated
> or specified anywhere else in the code.
> 
> I've been trying to come up with a small example, but I haven't been
> able to.  I have a pretty complicated template class hierarchy that
> triggers this problem.  I'll keep chiseling away at it, but I was
> wondering if anyone else has seen this problem.
> 
>                 -Fred


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]