public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64372] New: Spurious warning with throw in ternary operator returning const reference
@ 2014-12-21 18:43 tavianator at gmail dot com
  2014-12-22  0:49 ` [Bug c++/64372] " manu at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tavianator at gmail dot com @ 2014-12-21 18:43 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2892 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64372

            Bug ID: 64372
           Summary: Spurious warning with throw in ternary operator
                    returning const reference
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tavianator at gmail dot com

The following program produces a spurious warning:

$ cat ternary-warning.cpp
const char&
foo(const char* ptr)
{
  return ptr ? *ptr : throw ptr;
}
$ g++ -Wall -c ternary-warning.cpp
ternary-warning.cpp: In function ‘const char& foo(const char*)’:
ternary-warning.cpp:4:29: warning: returning reference to temporary
[-Wreturn-local-addr]
   return ptr ? *ptr : throw ptr;
                             ^
>From gcc-bugs-return-471518-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Dec 21 18:47:05 2014
Return-Path: <gcc-bugs-return-471518-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17562 invoked by alias); 21 Dec 2014 18:47:04 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17498 invoked by uid 48); 21 Dec 2014 18:47:01 -0000
From: "danglin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs
Date: Sun, 21 Dec 2014 18:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: danglin at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ebotcazou at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-62631-4-ei5pwUweyA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62631-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62631-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg02525.txt.bz2
Content-length: 238

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb631

--- Comment #11 from John David Anglin <danglin at gcc dot gnu.org> ---
Created attachment 34308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4308&actioníit
hppa ivopts dump


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-31 22:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-21 18:43 [Bug c++/64372] New: Spurious warning with throw in ternary operator returning const reference tavianator at gmail dot com
2014-12-22  0:49 ` [Bug c++/64372] " manu at gcc dot gnu.org
2014-12-22  7:31 ` harald at gigawatt dot nl
2014-12-22  7:38 ` tavianator at gmail dot com
2014-12-23 14:15 ` [Bug c++/64372] [DR1560] Gratuitous lvalue-to-rvalue conversion in conditional-expression with throw-expression operand harald at gigawatt dot nl
2021-07-23  0:06 ` pinskia at gcc dot gnu.org
2021-07-31 22:02 ` pinskia at gcc dot gnu.org

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).