public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: giovannibajo@libero.it To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, serge.bogdanov@intel.com Subject: Re: c++/4337: [2003-01-01]c++ ignores cast operator Date: Mon, 05 May 2003 01:14:00 -0000 [thread overview] Message-ID: <20030505011402.20805.qmail@sources.redhat.com> (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 State-Changed-Why: 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()". http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4337
next 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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030505011402.20805.qmail@sources.redhat.com \ --to=giovannibajo@libero.it \ --cc=gcc-bugs@gcc.gnu.org \ --cc=gcc-gnats@gcc.gnu.org \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ --cc=serge.bogdanov@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe 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).