public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement @ 2010-04-22 19:16 paul dot bibbings at gmail dot com 2010-04-22 20:04 ` [Bug c++/43856] " paolo dot carlini at oracle dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: paul dot bibbings at gmail dot com @ 2010-04-22 19:16 UTC (permalink / raw) To: gcc-bugs [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 4757 bytes --] When attempting to compile the following code taken directly from [expr.prim.lambda] 5.1.2/7 (n3092, FCD): 19:56:28 Paul Bibbings@JIJOU /cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_7.cpp // file: _5_1_2_7.cpp struct S1 { int x, y; int operator()(int); void f() { [=]()->int { return operator()(this->x + y); }; } }; gcc-4.5.0 fails to apply all aspects of the clause correctly: 5.1.2/7: "The lambda-expressions compound-statement yields the function-body (8.4) of the function call operator, but for purposes of name lookup (3.4), determining the type and value of this (9.3.2) and transforming id-expressions referring to non-static class members into class member access expressions using (*this) (9.3.1), the compound-statement is considered in the context of the lambda-expression." Specifically, it fails in transforming operator()(this->x + y) into (*this).operator()(this->x + y). 19:56:37 Paul Bibbings@JIJOU /cygdrive/d/CPPProjects/nano/gcc_bugs $i686-pc-cygwin-gcc-4.5.0 -v -save-temps -Wall -std=c++0x -pedantic -c _5_1_2_7.cpp Using built-in specs. COLLECT_GCC=i686-pc-cygwin-gcc-4.5.0 COLLECT_LTO_WRAPPER=/opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/lto-wrapper.exe Target: i686-pc-cygwin Configured with: ./configure --prefix=/opt/gcc-4.5.0 --enable-bootstrap --enable-version-specific-runtime-libs --enable-static --enable-shared --enable-shared-libgcc --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=c,c++ --disable-symvers --enable-libgomp --enable-libssp --enable-threads=posix --with-arch-i686 --with-tune=generic Thread model: posix gcc version 4.5.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-std=c++0x' '-pedantic' '-c' '-mtune=generic' '-march=pentiumpro' /opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/cc1plus.exe -E -quiet -v -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/../include/w32api -idirafter ../../include/w32api _5_1_2_7.cpp -mtune=generic -march=pentiumpro -std=c++0x -Wall -pedantic -fpch-preprocess -o _5_1_2_7.ii ignoring nonexistent directory "/opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/../../../../i686-pc-cygwin/include" ignoring nonexistent directory "../../include/w32api" #include "..." search starts here: #include <...> search starts here: /opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/include/c++ /opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/i686-pc-cygwin /opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/include/c++/backward /usr/local/include /opt/gcc-4.5.0/include /opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/include /opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/include-fixed /usr/include /usr/lib/../include/w32api End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-std=c++0x' '-pedantic' '-c' '-mtune=generic' '-march=pentiumpro' /opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/cc1plus.exe -fpreprocessed _5_1_2_7.ii -quiet -dumpbase _5_1_2_7.cpp -mtune=generic -march=pentiumpro -auxbase _5_1_2_7 -Wall -pedantic -std=c++0x -version -o _5_1_2_7.s GNU C++ (GCC) version 4.5.0 (i686-pc-cygwin) compiled by GNU C version 4.5.0, GMP version 4.3.2, MPFR version 2.4.1, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129712 GNU C++ (GCC) version 4.5.0 (i686-pc-cygwin) Compiler executable checksum: 81a7a49c1fa28713ff621b6b856147c0 _5_1_2_7.cpp: In lambda function: _5_1_2_7.cpp:7:14: error: this has incomplete type _5_1_2_7.cpp:7:9: error: forward declaration of struct S1::f()::<lambda()> _5_1_2_7.cpp:7:14: note: candidate is: S1::f()::<lambda()> If the given code is augmented to include an explicit reference to (*this) on the invocation of op() in the return statement, as: struct S1 { int x, y; int operator()(int); void f() { [=]()->int { return (*this).operator()(this->x + y); }; } }; then compilation succeeds. 20:08:51 Paul Bibbings@JIJOU /cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_7.ii # 1 "_5_1_2_7.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "_5_1_2_7.cpp" struct S1 { int x, y; int operator()(int); void f() { [=]()->int { return operator()(this->x + y); }; } }; -- Summary: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paul dot bibbings at gmail dot com GCC host triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43856] [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com @ 2010-04-22 20:04 ` paolo dot carlini at oracle dot com 2010-04-27 21:26 ` jason at gcc dot gnu dot org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: paolo dot carlini at oracle dot com @ 2010-04-22 20:04 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from paolo dot carlini at oracle dot com 2010-04-22 20:04 ------- Let's CC Jason. -- paolo dot carlini at oracle dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC|paul dot bibbings at gmail |jason at gcc dot gnu dot org |dot com | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43856] [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com 2010-04-22 20:04 ` [Bug c++/43856] " paolo dot carlini at oracle dot com @ 2010-04-27 21:26 ` jason at gcc dot gnu dot org 2010-04-27 23:03 ` jason at gcc dot gnu dot org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu dot org @ 2010-04-27 21:26 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from jason at gcc dot gnu dot org 2010-04-27 21:26 ------- Subject: Bug 43856 Author: jason Date: Tue Apr 27 21:26:25 2010 New Revision: 158807 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158807 Log: PR c++/43856 * name-lookup.c (qualify_lookup): Disqualify lambda op(). * class.c (current_nonlambda_class_type): New fn. * semantics.c (nonlambda_method_basetype): New. * cp-tree.h: Declare them. * tree.c (maybe_dummy_object): Handle implicit 'this' capture. Added: trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/name-lookup.c trunk/gcc/cp/semantics.c trunk/gcc/cp/tree.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43856] [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com 2010-04-22 20:04 ` [Bug c++/43856] " paolo dot carlini at oracle dot com 2010-04-27 21:26 ` jason at gcc dot gnu dot org @ 2010-04-27 23:03 ` jason at gcc dot gnu dot org 2010-05-06 16:49 ` jason at gcc dot gnu dot org 2010-05-06 16:49 ` jason at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu dot org @ 2010-04-27 23:03 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from jason at gcc dot gnu dot org 2010-04-27 23:03 ------- Subject: Bug 43856 Author: jason Date: Tue Apr 27 23:03:06 2010 New Revision: 158815 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158815 Log: PR c++/43856 * name-lookup.c (qualify_lookup): Disqualify lambda op(). * semantics.c (nonlambda_method_basetype): New. * cp-tree.h: Declare it. * tree.c (maybe_dummy_object): Handle implicit 'this' capture. Added: branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C Modified: branches/gcc-4_5-branch/gcc/cp/ChangeLog branches/gcc-4_5-branch/gcc/cp/cp-tree.h branches/gcc-4_5-branch/gcc/cp/name-lookup.c branches/gcc-4_5-branch/gcc/cp/semantics.c branches/gcc-4_5-branch/gcc/cp/tree.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43856] [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com ` (2 preceding siblings ...) 2010-04-27 23:03 ` jason at gcc dot gnu dot org @ 2010-05-06 16:49 ` jason at gcc dot gnu dot org 2010-05-06 16:49 ` jason at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu dot org @ 2010-05-06 16:49 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from jason at gcc dot gnu dot org 2010-05-06 16:49 ------- . -- jason at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/43856] [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com ` (3 preceding siblings ...) 2010-05-06 16:49 ` jason at gcc dot gnu dot org @ 2010-05-06 16:49 ` jason at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: jason at gcc dot gnu dot org @ 2010-05-06 16:49 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from jason at gcc dot gnu dot org 2010-05-06 16:49 ------- Fixed for 4.5.1. -- jason at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.5.1 Version|4.5.0 |4.4.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43856 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-06 16:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-04-22 19:16 [Bug c++/43856] New: [C++0x] gcc-4.5.0 fails to transform id-expression into class member access in lambda compound-statement paul dot bibbings at gmail dot com 2010-04-22 20:04 ` [Bug c++/43856] " paolo dot carlini at oracle dot com 2010-04-27 21:26 ` jason at gcc dot gnu dot org 2010-04-27 23:03 ` jason at gcc dot gnu dot org 2010-05-06 16:49 ` jason at gcc dot gnu dot org 2010-05-06 16:49 ` jason at gcc dot gnu dot 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).