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

            Bug ID: 118971
           Summary: GCC incorrectly accepts a C++ program with a malformed
                    lambda expression in the capture list
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qurong at ios dot ac.cn
  Target Milestone: ---

The compiler gcc accepts this program and clang will reject it.

void f(void) {
    constexpr int b = 4096;
    int a= [=, a] {
        return b;
    }();
}

int main() {
    f();
    return 0;
}

Reply via email to