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

            Bug ID: 95292
           Summary: internal compiler error
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tilin97 at yandex dot ru
  Target Milestone: ---

the following code causes an internal compiler error on versions from 7.1
onwards

#include <functional>

class A {
public:
        bool a;
        static inline std::function<void(A&)> foo = std::function<void(A&)>([]
(A& o) {
                bool A::*ptr = &A::a;
                o.*ptr = true;
        });
};

int main() {
        A a;
        A::foo(a);
}

gcc version 10.1.0 (Ubuntu 10.1.0-2ubuntu1~18.04)

===

gcc -std=c++17 main.cpp

during RTL pass: expand
main.cpp: In lambda function:
main.cpp:7:12: internal compiler error: in expand_expr_real_2, at expr.c:8538
    7 |   bool A::*ptr = &A::a;

===

OR

===

gcc -std=c++17 -O2 main.cpp

during IPA pass: icf
main.cpp:15:1: internal compiler error: in hash_operand, at fold-const.c:3768
   15 | }
      | ^

===

Reply via email to