public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43831]  New: [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8)
@ 2010-04-21 13:40 paul dot bibbings at gmail dot com
  2010-04-21 19:05 ` [Bug c++/43831] " redi at gcc dot gnu dot org
  0 siblings, 1 reply; 5+ messages in thread
From: paul dot bibbings at gmail dot com @ 2010-04-21 13:40 UTC (permalink / raw)
  To: gcc-bugs

The following code reproduces the Example in n3092 (FCD) 5.1.2/8, complete with
the comments given there:

14:36:12 Paul Bibbings@JIJOU
/cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_8.cpp
// file: _5_1_2_8.cpp

struct S2 { void f(int i); };
void S2::f(int i) {
   [&, i]{ };     // OK
   [&, &i]{ };    // error: i preceded by & when & is the default
   [=, this]{ };  // error: this when = is the default
   // [i, i]{ };     // error: i repeated
}



The fourth lambda-expression has been commented out to reflect the fact that
gcc-4.5.0 correctly handles this as an error.  The second and third - which
should be errors according 5.1.2/8 - are left uncommented.  gcc-4.5.0 compiles
this code without issuing an error, thus not handling the following from
5.1.2/8 correctly:
   - "If a lambda-capture includes a capture-default that is &, the identifiers
in the lambda capture shall not be preceded by &"; and
   - "If a lambda-capture includes a capture-default that is =, the lambda
capture shall not contain this."


14:33:29 Paul Bibbings@JIJOU
/cygdrive/d/CPPProjects/nano/gcc_bugs $make
i686-pc-cygwin-gcc-4.5.0 -v -save-temps -Wall -std=c++0x -pedantic -c
_5_1_2_8.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_8.cpp
-mtune=generic -march=pentiumpro -std=c++0x -Wall -pedantic -fpch-preprocess -o
_5_1_2_8.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_8.ii -quiet -dumpbase _5_1_2_8.cpp -mtune=generic -march=pentiumpro
-auxbase _5_1_2_8 -Wall -pedantic -std=c++0x -version -o _5_1_2_8.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
warning: GMP header version 4.3.2 differs from library version 4.3.1.
warning: MPFR header version 2.4.1 differs from library version 2.4.1-p5.
warning: MPC header version 0.8.1 differs from library version 0.8.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129712
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
warning: GMP header version 4.3.2 differs from library version 4.3.1.
warning: MPFR header version 2.4.1 differs from library version 2.4.1-p5.
warning: MPC header version 0.8.1 differs from library version 0.8.
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129712
Compiler executable checksum: 81a7a49c1fa28713ff621b6b856147c0
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-std=c++0x' '-pedantic' '-c'
'-mtune=generic' '-march=pentiumpro'
 as -v -o _5_1_2_8.o _5_1_2_8.s
GNU assembler version 2.20.51 (i686-cygwin) using BFD version (GNU Binutils)
2.20.51.20100410
COMPILER_PATH=/opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/:/opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/4.5.0/:/opt/gcc-4.5.0/libexec/gcc/i686-pc-cygwin/:/opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/:/opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/
LIBRARY_PATH=/opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/:/opt/gcc-4.5.0/lib/gcc/i686-pc-cygwin/4.5.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-std=c++0x' '-pedantic' '-c'
'-mtune=generic' '-march=pentiumpro'

14:33:31 Paul Bibbings@JIJOU
/cygdrive/d/CPPProjects/nano/gcc_bugs $


14:36:04 Paul Bibbings@JIJOU
/cygdrive/d/CPPProjects/nano/gcc_bugs $cat _5_1_2_8.ii
# 1 "_5_1_2_8.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "_5_1_2_8.cpp"


struct S2 { void f(int i); };
void S2::f(int i) {
   [&, i]{ };
   [&, &i]{ };
   [=, this]{ };

}


-- 
           Summary: [C++0x] gcc-4.5.0 does not fail invalid lambda captures
                    (against n3092 5.1.2/8)
           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=43831


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

* [Bug c++/43831] [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8)
  2010-04-21 13:40 [Bug c++/43831] New: [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8) paul dot bibbings at gmail dot com
@ 2010-04-21 19:05 ` redi at gcc dot gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-21 19:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-04-21 19:04:56
               date|                            |


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


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

* [Bug c++/43831] [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8)
       [not found] <bug-43831-4@http.gcc.gnu.org/bugzilla/>
  2011-06-18 19:14 ` jason at gcc dot gnu.org
  2011-06-20 14:40 ` jason at gcc dot gnu.org
@ 2011-06-20 14:56 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-20 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-20 14:55:05 UTC ---
Fixed for 4.7.0.


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

* [Bug c++/43831] [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8)
       [not found] <bug-43831-4@http.gcc.gnu.org/bugzilla/>
  2011-06-18 19:14 ` jason at gcc dot gnu.org
@ 2011-06-20 14:40 ` jason at gcc dot gnu.org
  2011-06-20 14:56 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-20 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-20 14:39:48 UTC ---
Author: jason
Date: Mon Jun 20 14:39:44 2011
New Revision: 175211

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175211
Log:
    PR c++/43831
    * parser.c (cp_parser_lambda_introducer): Complain about redundant
    captures.
    * semantics.c (add_capture): Likewise.
    (register_capture_members): Clear IDENTIFIER_MARKED.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/43831] [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8)
       [not found] <bug-43831-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-18 19:14 ` jason at gcc dot gnu.org
  2011-06-20 14:40 ` jason at gcc dot gnu.org
  2011-06-20 14:56 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-18 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

end of thread, other threads:[~2011-06-20 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21 13:40 [Bug c++/43831] New: [C++0x] gcc-4.5.0 does not fail invalid lambda captures (against n3092 5.1.2/8) paul dot bibbings at gmail dot com
2010-04-21 19:05 ` [Bug c++/43831] " redi at gcc dot gnu dot org
     [not found] <bug-43831-4@http.gcc.gnu.org/bugzilla/>
2011-06-18 19:14 ` jason at gcc dot gnu.org
2011-06-20 14:40 ` jason at gcc dot gnu.org
2011-06-20 14:56 ` 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).