This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/48103] New: Lambda function incorrect syntax leads to internal compiler error and segfault


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

           Summary: Lambda function incorrect syntax leads to internal
                    compiler error and segfault
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vlad@lazarenko.me


Here is a simple code snippet leading to compiler crash:

struct foo {
    void say () const {}
};

struct bar {};

template <typename T>
void do_work (const T & pred) {
    pred (foo ());
    pred (bar ());
}

int main () {
    do_work ([] (bar & b) { b.say (); });
}

Here is an output (with compilation flags):

$ g++ -std=c++0x -o test ./test.cpp 
./test.cpp: In lambda function:
./test.cpp:14:31: error: 'struct bar' has no member named 'say'
./test.cpp: In function 'void do_work(const T&) [with T =
main()::<lambda(bar&)>]':
./test.cpp:14:40:   instantiated from here
./test.cpp:9:5: error: no match for call to '(const main()::<lambda(bar&)>)
(foo)'
./test.cpp:14:15: note: candidates are:
./test.cpp:9:5: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

g++'s version:

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin10/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10
Configured with: ../gcc-4.6-20110129/configure --prefix=/opt/local
--build=x86_64-apple-darwin10 --enable-languages=c,c++,objc,obj-c++
--libdir=/opt/local/lib/gcc46 --includedir=/opt/local/include/gcc46
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.6 --with-local-prefix=/opt/local
--with-system-zlib --disable-nls --program-suffix=-mp-4.6
--with-gxx-include-dir=/opt/local/include/gcc46/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking
--disable-multilib --enable-fully-dynamic-string
Thread model: posix
gcc version 4.6.0 20110129 (experimental) (GCC) 

The operating system is Mac OS X 10.6.6, gcc is installed from Mac Ports 1.9.2.

The code itself is not legitimate, but compiler should not crash. So priority
is minor.
Please let me know if you need more details.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]