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

            Bug ID: 71082
           Summary: Internal compiler error when create initializer list
                    with pointers to members
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: farmaazon at gmail dot com
  Target Milestone: ---

Created attachment 38473
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38473&action=edit
preprocessed file of code in bug description

I try to compile the following code without any additional flags (just g++
gcc-6.1-bug.cpp)

#include <initializer_list>

class A {
public:
        int x;
        int xplus1() { return x+1; }
        int xplus2() { return x+2; }
};

int main()
{
        const auto members = { &A::xplus1, &A::xplus2 };

        A a;
        a.x = 12;
        int y;
        for (auto member : members)
                y = (a.*member)();
        return 0;
}

The result is an internal compiler error

Reply via email to