public inbox for
help / color / mirror / Atom feed
Subject: Re: c++/4337: [2003-01-01]c++ ignores cast operator
Date: Mon, 05 May 2003 01:14:00 -0000	[thread overview]
Message-ID: <> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

Synopsis: [2003-01-01]c++ ignores cast operator

State-Changed-From-To: analyzed->closed
State-Changed-By: bajo
State-Changed-When: Mon May  5 01:14:02 2003
    Not a bug. "a1 = (A1)a2" is a type conversion in cast 
    notation (§5.4). "a1 = const_cast<A1>(a2)" is 
    ill-formed, but "a1 = static_cast<A1>(a2)" is well-formed,
    because "a1 = A1(a2)" is well-formed (this is the exact
    condition specified by §5.2.9p2). Thus, for §5.4p5, the
    cast notation is equivalent to the static_cast notation.
    The static_cast notation is then equivalent to 
    "a1 = A1(a2)", which upcasts a2 to const A& implicitally,
    and then invokes A1(const A&). 
    G++ behaves exactly as the standard prescribes, and all
    the other compilers I have agree.
    If you need to force the use of the custom conversion 
    operator, you can still do it using the syntax
    "a1 = a2.operator A1()".

             reply	other threads:[~2003-05-05  1:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-05  1:14 giovannibajo [this message]
2003-05-13 21:19 Bogdanov, Serge
2003-05-14  0:46 Giovanni Bajo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).