From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32611 invoked by alias); 18 Mar 2002 14:02:27 -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 32533 invoked by uid 61); 18 Mar 2002 14:02:22 -0000 Date: Mon, 18 Mar 2002 06:02:00 -0000 Message-ID: <20020318140221.32532.qmail@sources.redhat.com> To: andrewp@andypo.net, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, gdr@gcc.gnu.org, jason@gcc.gnu.org From: jason@gcc.gnu.org Reply-To: jason@gcc.gnu.org, andrewp@andypo.net, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, gdr@gcc.gnu.org, jason@gcc.gnu.org, gcc-gnats@gcc.gnu.org X-Mailer: gnatsweb 2.9.3 Subject: Re: c++/3230: False warning for 'returning reference to temporary' X-SW-Source: 2002-03/txt/msg00651.txt.bz2 List-Id: Synopsis: False warning for 'returning reference to temporary' Responsible-Changed-From-To: gdr->jason Responsible-Changed-By: jason Responsible-Changed-When: Mon Mar 18 06:02:19 2002 Responsible-Changed-Why: mine State-Changed-From-To: analyzed->closed State-Changed-By: jason State-Changed-When: Mon Mar 18 06:02:19 2002 State-Changed-Why: This is not a bug in the compiler. The standard (5.16) says that the result of your ?: expression is an rvalue, because the two options do not have the same type. As a result, the return value binds to that rvalue, which is a local temporary. The EDG compiler gives the same warning. You may feel that this is a bug in the standard, and I'd be inclined to agree. But until the standard is fixed, the compiler will continue to work this way. If you'd like to submit a defect report against the standard, the place for that is comp.std.c++. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3230