From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7767 invoked by alias); 7 Jul 2014 14:17:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7408 invoked by uid 48); 7 Jul 2014 14:17:18 -0000 From: "kaballo86 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61736] New: Conditional expression yields wrong value category Date: Mon, 07 Jul 2014 14:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kaballo86 at hotmail dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg00376.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61736 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 initializatio= n of non-const reference of type =E2=80=98int&=E2=80=99 from an rvalue of type = =E2=80=98int=E2=80=99: int* foo(){ return nullptr; } int& bar(){ return foo() !=3D nullptr ? *foo() : throw 0; } // error int main() { int& ref =3D bar(); } According to [expr.cond]/2: > If either the second or the third operand has type void, one of the follo= wing shall hold: > =E2=80=94 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: 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: List-Archive: List-Post: List-Help: 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" 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: In-Reply-To: References: 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?id=58898 --- Comment #2 from 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=212331&root=gcc&view=rev Log: 2014-07-07 Paolo Carlini PR c++/58898 * g++.dg/parse/pr58898.C: New. Added: trunk/gcc/testsuite/g++.dg/parse/pr58898.C Modified: trunk/gcc/testsuite/ChangeLog