From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AFD98385C426; Mon, 23 Mar 2020 00:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFD98385C426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584922875; bh=vHQh4GEUPd6B60OfI5jPS/10Q0c1a1Y6VTtgNX5d+qA=; h=From:To:Subject:Date:From; b=m1iQWz+RIQFVXsWNhPmd3in7F5TBjpjwUep6jBCpnnkKFi18Xoeb1O8bCD5mohEyI cU82ublDlZigExCmZnck4ft2lLEhiZhNTQ4IOg3OARoczEbmBUpBjxxZ+f/a8Q7ve0 3vYesc6EDp5qM6c+pGJbfEgOg4MebWjDwgWX5EmU= From: "ndkrempel at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94264] New: Array-to-pointer conversion not performed on array prvalues Date: Mon, 23 Mar 2020 00:21:15 +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: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ndkrempel at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone 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-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2020 00:21:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94264 Bug ID: 94264 Summary: Array-to-pointer conversion not performed on array prvalues Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ndkrempel at gmail dot com Target Milestone: --- I think the most clearcut example is: int main() { using T =3D int[]; T{1, 2} =3D=3D nullptr; } This compiles fine with clang, and is supported by the standard: the =3D=3D operator explicitly performs array-to-pointer conversion (https://eel.is/c++draft/expr#eq-1), and array-to-pointer conversion is explicitly defined for rvalue arrays (https://eel.is/c++draft/expr#conv.arr= ay). Other examples (which again all compile with clang) are: +T{1, 2}; Here the standard wording seems to have a minor bug, as unary "+" does not explicitly perform the array-to-pointer conversion, and the general rubric = for applying it (https://eel.is/c++draft/expr#basic.lval-6) only applies to glvalues as written. T{1, 2} + 1; Ditto. *(T{1, 2} + 1); Interesting as T{1, 2}[1] should be equivalent to this (modulo the value category of the result, https://eel.is/c++draft/expr#sub), yet the former is rejected by gcc and the latter accepted.=