public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61736] New: Conditional expression yields wrong value category
@ 2014-07-07 14:17 kaballo86 at hotmail dot com
2014-10-02 9:18 ` [Bug c++/61736] " redi at gcc dot gnu.org
2021-07-31 22:02 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: kaballo86 at hotmail dot com @ 2014-07-07 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61736
Bug ID: 61736
Summary: Conditional expression yields wrong value category
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kaballo86 at hotmail dot com
The following snippet results in a compilation error: invalid initialization of
non-const reference of type ‘int&’ from an rvalue of type ‘int’:
int* foo(){ return nullptr; }
int& bar(){ return foo() != nullptr ? *foo() : throw 0; } // error
int main() {
int& ref = bar();
}
According to [expr.cond]/2:
> If either the second or the third operand has type void, one of the following shall hold:
> — The second or the third operand (but not both) is a (possibly parenthesized) throw-expression (15.1); the result is of the type and value category of the other.
The value category of the conditional expression would be that of `*foo()`,
which should be an lvalue and bind to `int&`.
>From gcc-bugs-return-455786-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 07 14:17:56 2014
Return-Path: <gcc-bugs-return-455786-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10294 invoked by alias); 7 Jul 2014 14:17:55 -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 10250 invoked by uid 55); 7 Jul 2014 14:17:51 -0000
From: "paolo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes compile error
Date: Mon, 07 Jul 2014 14:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-58898-4-xM8E2njNwV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58898-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58898-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-07/txt/msg00377.txt.bz2
Content-length: 469
https://gcc.gnu.org/bugzilla/show_bug.cgi?idX898
--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Mon Jul 7 14:17:17 2014
New Revision: 212331
URL: https://gcc.gnu.org/viewcvs?rev!2331&root=gcc&view=rev
Log:
2014-07-07 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58898
* g++.dg/parse/pr58898.C: New.
Added:
trunk/gcc/testsuite/g++.dg/parse/pr58898.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/61736] Conditional expression yields wrong value category
2014-07-07 14:17 [Bug c++/61736] New: Conditional expression yields wrong value category kaballo86 at hotmail dot com
@ 2014-10-02 9:18 ` redi at gcc dot gnu.org
2021-07-31 22:02 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-02 9:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61736
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-10-02
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/61736] Conditional expression yields wrong value category
2014-07-07 14:17 [Bug c++/61736] New: Conditional expression yields wrong value category kaballo86 at hotmail dot com
2014-10-02 9:18 ` [Bug c++/61736] " redi at gcc dot gnu.org
@ 2021-07-31 22:02 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 22:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61736
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 64372. Fixed in GCC 10+.
*** This bug has been marked as a duplicate of bug 64372 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-31 22:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 14:17 [Bug c++/61736] New: Conditional expression yields wrong value category kaballo86 at hotmail dot com
2014-10-02 9:18 ` [Bug c++/61736] " redi 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).