public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67810] New: Non-expression recognized as fold expression
@ 2015-10-01 20:54 Casey at Carter dot net
  2015-10-02  1:04 ` [Bug c++/67810] " Casey at Carter dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Casey at Carter dot net @ 2015-10-01 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67810
           Summary: Non-expression recognized as fold expression
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

r228351 fails to compile this correct program:

template <class...>
constexpr bool Test = true;

template <typename...Ts, bool = (Test<Ts&&...>)>
void f();

with error:

~/gcc6-r228351/bin/g++ -std=c++14 -c foo.cpp 
foo.cpp:4:41: warning: fold-expressions only available with -std=c++1z or
-std=gnu++1z
 template <typename...Ts, bool = (Test<Ts&&...>)>
                                         ^
foo.cpp:4:47: error: expected binary operator before ‘)’ token
 template <typename...Ts, bool = (Test<Ts&&...>)>
                                               ^
foo.cpp:5:1: error: expected primary-expression before ‘void’
 void f();
 ^
foo.cpp:5:1: error: expected ‘>’ before ‘void’
foo.cpp:5:9: error: expected unqualified-id before ‘;’ token
 void f();
         ^
>From gcc-bugs-return-498555-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Oct 01 20:56:26 2015
Return-Path: <gcc-bugs-return-498555-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 122775 invoked by alias); 1 Oct 2015 20:56:25 -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 122685 invoked by uid 48); 1 Oct 2015 20:56:12 -0000
From: "matt at godbolt dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/67809] Empty pointer-chasing loops aren't optimized out
Date: Thu, 01 Oct 2015 20:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 5.2.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: matt at godbolt dot org
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: cc
Message-ID: <bug-67809-4-2m5IQHO1eQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67809-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67809-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: 2015-10/txt/msg00110.txt.bz2
Content-length: 587

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

Matt Godbolt <matt at godbolt dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matt at godbolt dot org

--- Comment #1 from Matt Godbolt <matt at godbolt dot org> ---
A colleague has pointed out this of course is not a "do nothing" if the list is
circular. IANALL but I wonder if clang/icc take advantage of some kind of
"infinite loop is undefined behaviour" here that GCC doesn't.


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

* [Bug c++/67810] Non-expression recognized as fold expression
  2015-10-01 20:54 [Bug c++/67810] New: Non-expression recognized as fold expression Casey at Carter dot net
@ 2015-10-02  1:04 ` Casey at Carter dot net
  2015-10-06 21:31 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Casey at Carter dot net @ 2015-10-02  1:04 UTC (permalink / raw)
  To: gcc-bugs

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

Casey Carter <Casey at Carter dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Casey at Carter dot net,
                   |                            |jason at gcc dot gnu.org

--- Comment #1 from Casey Carter <Casey at Carter dot net> ---
Presumably this bug was introduced by the implementation of fold expressions in
r227883. CCing Jason.


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

* [Bug c++/67810] Non-expression recognized as fold expression
  2015-10-01 20:54 [Bug c++/67810] New: Non-expression recognized as fold expression Casey at Carter dot net
  2015-10-02  1:04 ` [Bug c++/67810] " Casey at Carter dot net
@ 2015-10-06 21:31 ` jason at gcc dot gnu.org
  2015-10-07  1:47 ` jason at gcc dot gnu.org
  2015-10-07  1:59 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-10-06 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-10-06
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug c++/67810] Non-expression recognized as fold expression
  2015-10-01 20:54 [Bug c++/67810] New: Non-expression recognized as fold expression Casey at Carter dot net
  2015-10-02  1:04 ` [Bug c++/67810] " Casey at Carter dot net
  2015-10-06 21:31 ` jason at gcc dot gnu.org
@ 2015-10-07  1:47 ` jason at gcc dot gnu.org
  2015-10-07  1:59 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-10-07  1:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Oct  7 01:46:54 2015
New Revision: 228556

URL: https://gcc.gnu.org/viewcvs?rev=228556&root=gcc&view=rev
Log:
        PR c++/67810
        * parser.c (cp_parser_fold_expr_p): Remove.
        (is_binary_op): New.
        (cp_parser_fold_expression): Take LHS as parameter.
        (cp_parser_primary_expression): Call it after parsing an expression.
        (cp_parser_binary_expression, cp_parser_assignment_operator_opt)
        (cp_parser_expression): Ignore an operator followed by '...'.
        (is_binary_op): New.
        * pt.c (tsubst_unary_left_fold, tsubst_binary_left_fold)
        (tsubst_unary_right_fold, tsubst_binary_right_fold): Handle errors.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/var-templ45.C
    trunk/gcc/testsuite/g++.dg/cpp1z/fold6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/g++.dg/cpp1z/fold2.C


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

* [Bug c++/67810] Non-expression recognized as fold expression
  2015-10-01 20:54 [Bug c++/67810] New: Non-expression recognized as fold expression Casey at Carter dot net
                   ` (2 preceding siblings ...)
  2015-10-07  1:47 ` jason at gcc dot gnu.org
@ 2015-10-07  1:59 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-10-07  1:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-10-07  1:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 20:54 [Bug c++/67810] New: Non-expression recognized as fold expression Casey at Carter dot net
2015-10-02  1:04 ` [Bug c++/67810] " Casey at Carter dot net
2015-10-06 21:31 ` jason at gcc dot gnu.org
2015-10-07  1:47 ` jason at gcc dot gnu.org
2015-10-07  1:59 ` jason 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).