Skip to content

[clang] Statement expressions with trailing semicolons behave differently from GCC #160243

@KaiYG

Description

@KaiYG
int foo() {
    return ({1; 2; 3;;});
}

https://godbolt.org/z/W5PYc1PE4

In G++, the statement expression results in a null, while in Clang++ it evaluates to 3.

This difference is likely caused by b1e511b, but I’m not sure what the intended behavior is supposed to be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issuegood first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions