This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Implicit conversion error using g++
- To: Daniel dot Walker at lhsl dot com
- Subject: Re: Implicit conversion error using g++
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 10 Jul 2001 00:55:24 -0300
- Cc: David Berthelot <davidb at Magma-DA dot COM>, gcc-help at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <OF1188538E.FC135F8F-ON88256A84.0079EEFF@lhs.com>
On Jul 9, 2001, Daniel.Walker@lhsl.com wrote:
> With copy-initialization the target object is always initialized
> with the copy-constructor.
Actually, the compiler is allowed to omit the construction of the
temporary and the copy construction, but it must still check whether
the copy-constructor exists and is accessible.
> So, it had
> better be able to get a temporary to copy from in one conversion (my
> example required two conversion; a cast and then a constructor, so it was
> ill-formed
Right.
> With direct-initialization any constructor may be used (in my
> example, gcc found the cast operator to Foo and matched that to a
> constructor from Foo.)
Yup.
> Does the standard give implementers leeway with how many can
> be involved in an implicit conversion or is this set in stone?
It's set in stone. A user-defined conversion sequence is formed by a
standard conversion sequence, followed by a user-defined conversion
followed by a second standard conversion sequence. [over.ics.user]/1
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me