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++/47212] New: [C++0x] crash on lambda returning lambda


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

           Summary: [C++0x] crash on lambda returning lambda
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: a71104@gmail.com


Here's the code:



==============================================

#include <iostream>
using namespace std;

auto test = [] () {
    return [] (istream &ris) -> istream& {
        return ris;
    };
};

int main() {
    cin >> test();
    return 0;
}

==============================================



I'm not sure whether this code is correct but it just crashes g++ 4.5.0.
I'm compiling with:

g++ -std=c++0x -pedantic -Wall Test.cpp



I'm doing code like that because I wish to implement a custom parameterized I/O
manipulator without using implementation-specific types such as smanip and
stuff.
Note that it doesn't crash if I just call test() without using the result on
cin, thus I think the problem is matching the returned lambda against the
version of operator >> that takes a function as an argument.

PS: I don't think there's any difference but I'm using MinGW and I'm currently
unable to test on Linux with real g++.


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