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]

typedef vs. typename confusion


>>>>> «Fred», Fred Richardson <frichard@bbn.com> wrote:

Fred> Hi-
Fred> I have some older template code (which is too big to paste here) which
Fred> used to compile and run with egcs-1.0.3 but breaks with the following
Fred> version of egcs off the 1.1 CVS branch:

Fred>   % gcc -v
Fred>   Reading specs from /d4mutl/bybrad.dev/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.52/specs
Fred>   gcc version egcs-2.91.52 19980802 (gcc2 ss-980609 experimental)
Fred>   %

Fred> The problem I found is that if I neglect to use typename in certain
Fred> places, the compiler will get confused and use a different (and on my
Fred> part unspecified) set of template parameters (currently for or in a
Fred> friend function) and complain that no match can be found for the
Fred> function I'm calling.  Usually the function(s) it lists in the
Fred> possible matches have parameters for classes that I never instantiated 
Fred> or specified anywhere else in the code.


There was a related posting two or three weeks ago. It was argued
that egcs, unilaterally, supplies the keyword 'typename' where needed
--or more accurately, where he thinks he could do so without transmuting
programs. I strongly objected against such *default* behaviour. I hope
this report  will be enough convincing to supply the standard
behaviour, by *default*.

Fred> I've been trying to come up with a small example, but I haven't been
Fred> able to.  I have a pretty complicated template class hierarchy that
Fred> triggers this problem.  I'll keep chiseling away at it, but I was
Fred> wondering if anyone else has seen this problem.


Fred>                 -Fred

-- Gaby
"One reason that life is complex is that it has a 
real part and imaginary part." -- Andrew Koenig


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