This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
typedef vs. typename confusion
- To: egcs at cygnus dot com
- Subject: typedef vs. typename confusion
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr>
- Date: Tue, 4 Aug 1998 03:18:14 +0200 (MET DST)
- References: <199808031605.MAA26876@bbn.com>
>>>>> «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