From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20829 invoked by alias); 5 May 2003 01:14:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 20806 invoked by uid 48); 5 May 2003 01:14:02 -0000 Date: Mon, 05 May 2003 01:14:00 -0000 Message-ID: <20030505011402.20805.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, serge.bogdanov@intel.com From: giovannibajo@libero.it Reply-To: giovannibajo@libero.it, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, serge.bogdanov@intel.com, gcc-gnats@gcc.gnu.org Subject: Re: c++/4337: [2003-01-01]c++ ignores cast operator X-SW-Source: 2003-05/txt/msg00259.txt.bz2 List-Id: 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(a2)" is ill-formed, but "a1 = static_cast(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