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

            Bug ID: 103885
           Summary: ICE in capturing lambda for certain constexpr/auto
                    combination
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cbcode at gmail dot com
  Target Milestone: ---

ICE on the line indicated below.

void test() {
    constexpr int N = 1;
    constexpr auto a1 = [](auto){
        static_assert(N == 1); //OK
        return 2;
    }(3);
    constexpr auto a2 = [=](auto){
        static_assert(N == 1); //OK
        return 2;
    }(3);
    constexpr auto a3 = [&](int){
        static_assert(N == 1); //OK
        return 2;
    }(3);
    constexpr auto a4 = [&](auto){
        static_assert(N == 1); //ICE in tsubst_copy, at cp/pt.c:16780
        return 2;
    }(3);
}

Reply via email to