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++/64915] New: lambda partially drops constness of 'this'


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64915

            Bug ID: 64915
           Summary: lambda partially drops constness of 'this'
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gene at staubsaal dot de

When calling a non-const member function inside a lambda expression the
constness of 'this' is being ignored:

Example example.cpp:
struct Foo {
    int x;
    void bar() const {
        [=]() { bad(); }(); // This sould be an compiler error
    }
    void bad() {
        x = 42;
    }
};

compiled with: g++ -std=c++11 -Wall -Wextra


More Info
$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2


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