Implicit conversion error using g++
Alexandre Oliva
aoliva@redhat.com
Mon Jul 9 20:55:00 GMT 2001
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
More information about the Gcc-help
mailing list