Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on https://cppinsights.io when trying code with member variables of type std::function<void()> and assigning it with lambda expression #205

Closed
fadi-botros opened this issue Jun 28, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@fadi-botros
Copy link

fadi-botros commented Jun 28, 2019

This code crashed https://cppinsights.io, tried C++11, C++14, C++17 and C++2a

#include <iostream>
#include <functional>
class EventContainer {
    private:
        int val = 1234;
        std::function<void()> something = [=]() {
            std::cout << this->val;
        };
};

int main() {
  return 0;
}
@andreasfertig andreasfertig added the bug Something isn't working label Jun 29, 2019
@andreasfertig
Copy link
Owner

Hello @fadi-botros,

thank you for reporting that. I will look into it. Probably another case of a lambda which I haven't thought about yet.

Andreas

andreasfertig added a commit that referenced this issue Jul 16, 2019
Fixed #205: Make lambdas as in class initializer work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants