This is the mail archive of the gcc-help@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]

Re: Implicit conversion error using g++


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


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