public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax.
@ 2014-08-23 18:42 0xd34df00d at gmail dot com
  2014-08-23 18:43 ` [Bug c++/62241] " 0xd34df00d at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: 0xd34df00d at gmail dot com @ 2014-08-23 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62241
           Summary: C++14 generalized lambda capture doesn't work with
                    uniform initialization syntax.
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 0xd34df00d at gmail dot com

Created attachment 33386
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33386&action=edit
Failing code

Passing a lambda copying a value in its capture clause in a braced-init-list
causes the compiler to issue `error: 'foo' was not declared in this scope`,
where `foo` is the name of the copy.

Important part is the error only happens if using the uniform initialization
syntax. If the lambda is passed to a class ctor invoked via the standard '()'
syntax, everything works fine.

This is reproducible on 4.9.0 and 4.9.1 for me. I haven't had a chance to test
4.9.2 though.


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
@ 2014-08-23 18:43 ` 0xd34df00d at gmail dot com
  2014-08-23 18:54 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: 0xd34df00d at gmail dot com @ 2014-08-23 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Georg Rudoy <0xd34df00d at gmail dot com> ---
Created attachment 33387
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33387&action=edit
Successfully compiling code.


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
  2014-08-23 18:43 ` [Bug c++/62241] " 0xd34df00d at gmail dot com
@ 2014-08-23 18:54 ` pinskia at gcc dot gnu.org
  2014-08-23 19:00 ` 0xd34df00d at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-08-23 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Have you tried 5.x yet?


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
  2014-08-23 18:43 ` [Bug c++/62241] " 0xd34df00d at gmail dot com
  2014-08-23 18:54 ` pinskia at gcc dot gnu.org
@ 2014-08-23 19:00 ` 0xd34df00d at gmail dot com
  2014-08-23 19:03 ` 0xd34df00d at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: 0xd34df00d at gmail dot com @ 2014-08-23 19:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Georg Rudoy <0xd34df00d at gmail dot com> ---
Not yet. Should I?


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
                   ` (2 preceding siblings ...)
  2014-08-23 19:00 ` 0xd34df00d at gmail dot com
@ 2014-08-23 19:03 ` 0xd34df00d at gmail dot com
  2014-08-26 21:48 ` daniel.kruegler at googlemail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: 0xd34df00d at gmail dot com @ 2014-08-23 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Georg Rudoy <0xd34df00d at gmail dot com> ---
Also, while experimenting I've found that adding a non-initializing capture
element to the list somewhat mitigates the issue. That is, if the capture list
looks like `[smth, foo = bar]`, then everything builds fine.


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
                   ` (3 preceding siblings ...)
  2014-08-23 19:03 ` 0xd34df00d at gmail dot com
@ 2014-08-26 21:48 ` daniel.kruegler at googlemail dot com
  2014-12-14  0:06 ` ville.voutilainen at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2014-08-26 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Andrew Pinski from comment #2)
> Have you tried 5.x yet?

Trying 5.0.0 20140826 (experimental) the outcome is still the same rejection
>From gcc-bugs-return-459313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 26 21:59:54 2014
Return-Path: <gcc-bugs-return-459313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6457 invoked by alias); 26 Aug 2014 21:59:54 -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 6398 invoked by uid 48); 26 Aug 2014 21:59:50 -0000
From: "carrot at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/62262] aarch64 gcc generates invalid assembler
Date: Tue, 26 Aug 2014 21:59: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: carrot at google dot com
X-Bugzilla-Status: NEW
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-62262-4-mM8YNfPDdT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62262-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62262-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-08/txt/msg01810.txt.bz2
Content-length: 1188

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

--- Comment #5 from Carrot <carrot at google dot com> ---
(In reply to amker from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > (insn 27 26 40 5 (set (reg:SI 73 [ D.2590 ])
> >         (and:SI (ashift:SI (reg/v:SI 74 [ value ])
> >                 (const_int 32 [0x20]))
> >             (const_int 8388607 [0x7fffff]))) t7.c:13 611
> > {*andim_ashiftsi_bfiz}
> >      (expr_list:REG_DEAD (reg/v:SI 74 [ value ])
> >         (nil)))
> >
> > Confirmed.
> >
> >   "exact_log2 ((INTVAL (operands[3]) >> INTVAL (operands[2])) + 1) >= 0
> >    && (INTVAL (operands[3]) & ((1 << INTVAL (operands[2])) - 1)) == 0"
> >
> >
> > In fact we invoke undefined behavior inside the compiler too due to the
> > shift there.
>
> Since it's undefined code, how should we handle it in GCC?  Should we give
> warning messages as accurate as possible?  But that sounds impractical
> either, since "value << 1" and "value <<= zeros" could be undefined too.

Actually the original source code is guarded by assert, and the parameter
passed to CLZ can be guaranteed not 0, so "value <<= zeros" is well defined in
our original source code.


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
                   ` (4 preceding siblings ...)
  2014-08-26 21:48 ` daniel.kruegler at googlemail dot com
@ 2014-12-14  0:06 ` ville.voutilainen at gmail dot com
  2015-01-20 11:59 ` paolo at gcc dot gnu.org
  2015-01-20 11:59 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14  0:06 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-14
                 CC|                            |ville.voutilainen at gmail dot com
      Known to work|                            |5.0
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.1

--- Comment #6 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Current trunk accepts the code. 4.9.1 doesn't, but it should.


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
                   ` (5 preceding siblings ...)
  2014-12-14  0:06 ` ville.voutilainen at gmail dot com
@ 2015-01-20 11:59 ` paolo at gcc dot gnu.org
  2015-01-20 11:59 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-01-20 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue Jan 20 11:58:43 2015
New Revision: 219890

URL: https://gcc.gnu.org/viewcvs?rev=219890&root=gcc&view=rev
Log:
2015-01-20  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/62241
    * g++.dg/cpp1y/lambda-init12.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-init12.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/62241] C++14 generalized lambda capture doesn't work with uniform initialization syntax.
  2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
                   ` (6 preceding siblings ...)
  2015-01-20 11:59 ` paolo at gcc dot gnu.org
@ 2015-01-20 11:59 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-01-20 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

end of thread, other threads:[~2015-01-20 11:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-23 18:42 [Bug c++/62241] New: C++14 generalized lambda capture doesn't work with uniform initialization syntax 0xd34df00d at gmail dot com
2014-08-23 18:43 ` [Bug c++/62241] " 0xd34df00d at gmail dot com
2014-08-23 18:54 ` pinskia at gcc dot gnu.org
2014-08-23 19:00 ` 0xd34df00d at gmail dot com
2014-08-23 19:03 ` 0xd34df00d at gmail dot com
2014-08-26 21:48 ` daniel.kruegler at googlemail dot com
2014-12-14  0:06 ` ville.voutilainen at gmail dot com
2015-01-20 11:59 ` paolo at gcc dot gnu.org
2015-01-20 11:59 ` paolo.carlini at oracle dot com

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