Skip to content

Wrong end location for VarDecl that is move constructed from a prvalue #169974

@tJener

Description

@tJener

See https://godbolt.org/z/jPcdfeW6G.

// Minimal repro.
struct S {};
S MakeS();
void f() {
  S s(MakeS());
}

The source range for the VarDecl s ends on the first ), which is part of the call to MakeS().

This occurs starting in C++17. In C++14, there is a ExprWithCleanups, CXXConstructExpr, and MaterializeTemporaryExpr between the VarDecl and the CallExpr to MakeS(). This seems similar to #143711, except this time we lose a paren, instead of gaining one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions