member-template bug in egcs

Alexandre Oliva oliva@dcc.unicamp.br
Thu Nov 20 20:23:00 GMT 1997


Michael A Benzinger writes:

> If you refer to Bjarne Stroustrup's
> book "The C++ Programming Language, Third Edition" on page 347 you will
> find the following example in section 13.6.2

if you're quoting the example correctly, I'm pretty sure this template
constructor has no purpose at all, since it is not a copy-constructor
(no template constructor is), and one specialization of class complex
does not have access to fields `re' and `im' of any other
specialization thereof.

> In other words, you can construct a complex<T1> from a complex<T2> if and
> only if you can initialize a T1 by a T2.  That seems reasonable."

It really does, but, unless I've missed some important part of the
standard, a specialization of a template class does not implicitly
gain priviledged access to another specialization of the same template
class.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



More information about the Gcc-bugs mailing list