public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes
@ 2013-02-19 20:38 gonzalobg88 at gmail dot com
  2013-02-19 20:53 ` [Bug c++/56402] " gonzalobg88 at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gonzalobg88 at gmail dot com @ 2013-02-19 20:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402

             Bug #: 56402
           Summary: Lambda's this pointer are not initialized inside
                    template classes
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gonzalobg88@gmail.com


Created attachment 29503
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29503
The first lambda produces a warning. It compiles but the program behaves wrong.
The second lambda crashes the compiler.

Compiling with: "g++-4.7.2 -std=c++11 -Wall -Wextra"

The first lambda produces the following warnign:
"warning: missing initializer for member ‘B<D>::foo() [with D =
void]::lambda()>::__this’ [-Wmissing-field-initializers]"

It recognizes that it has to capture the this pointer, but it does not
initialize it. The code compiles and the executable does not print 10 as it
should.

The second lambda crashes gcc with the following error:
"internal compiler error: in get_expr_operands, at tree-ssa-operands.c:1035"

This code compiles with clang 3.2 and produces the right output.


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

* [Bug c++/56402] Lambda's this pointer are not initialized inside template classes
  2013-02-19 20:38 [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes gonzalobg88 at gmail dot com
@ 2013-02-19 20:53 ` gonzalobg88 at gmail dot com
  2013-02-19 22:09 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gonzalobg88 at gmail dot com @ 2013-02-19 20:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402

--- Comment #1 from gnzlbg <gonzalobg88 at gmail dot com> 2013-02-19 20:52:55 UTC ---
To get the program to compile one has to comment out the second lambda which
makes the compiler crash.


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

* [Bug c++/56402] Lambda's this pointer are not initialized inside template classes
  2013-02-19 20:38 [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes gonzalobg88 at gmail dot com
  2013-02-19 20:53 ` [Bug c++/56402] " gonzalobg88 at gmail dot com
@ 2013-02-19 22:09 ` paolo.carlini at oracle dot com
  2013-02-19 22:10 ` paolo.carlini at oracle dot com
  2013-02-19 22:14 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-19 22:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-19 22:08:53 UTC ---
*** Bug 56400 has been marked as a duplicate of this bug. ***


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

* [Bug c++/56402] Lambda's this pointer are not initialized inside template classes
  2013-02-19 20:38 [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes gonzalobg88 at gmail dot com
  2013-02-19 20:53 ` [Bug c++/56402] " gonzalobg88 at gmail dot com
  2013-02-19 22:09 ` paolo.carlini at oracle dot com
@ 2013-02-19 22:10 ` paolo.carlini at oracle dot com
  2013-02-19 22:14 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-19 22:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-19 22:10:22 UTC ---
*** Bug 56401 has been marked as a duplicate of this bug. ***


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

* [Bug c++/56402] Lambda's this pointer are not initialized inside template classes
  2013-02-19 20:38 [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes gonzalobg88 at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-19 22:10 ` paolo.carlini at oracle dot com
@ 2013-02-19 22:14 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-02-19 22:14 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56402

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|gonzalobg88 at gmail dot    |
                   |com                         |
      Known to work|                            |4.7.3, 4.8.0
         Resolution|                            |WORKSFORME

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-02-19 22:14:32 UTC ---
Already fixed mainline and 4.7.3.


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

end of thread, other threads:[~2013-02-19 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 20:38 [Bug c++/56402] New: Lambda's this pointer are not initialized inside template classes gonzalobg88 at gmail dot com
2013-02-19 20:53 ` [Bug c++/56402] " gonzalobg88 at gmail dot com
2013-02-19 22:09 ` paolo.carlini at oracle dot com
2013-02-19 22:10 ` paolo.carlini at oracle dot com
2013-02-19 22:14 ` 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).