Skip to content

Clang getBeginLoc of some CXXConstructExpr has moved past namespace prefix #153540

@stbergmann

Description

@stbergmann

With test.cc being

namespace N { template<typename T> struct S { S(T); }; }
int main() {
  N::S(0);
}

doing clang++ -fsyntax-only -Xclang -ast-dump test.cc shows that, for recent LLVM trunk, the begin of the statement N::S(0); has moved from col 3 (before `N::?),

`-FunctionDecl 0x55bacea168b8 <line:2:1, line:4:1> line:2:5 main 'int ()'
  `-CompoundStmt 0x55bacea171b8 <col:12, line:4:1>
    `-CXXFunctionalCastExpr 0x55bacea17190 <line:3:3, col:9> 'N::S' functional cast to N::S <ConstructorConversion>
      `-CXXConstructExpr 0x55bacea17000 <col:3, col:9> 'N::S' 'void (int)'
        `-IntegerLiteral 0x55bacea16a68 <col:8> 'int' 0

to col 6 (after N::),

`-FunctionDecl 0x3f53d5d8 <line:2:1, line:4:1> line:2:5 main 'int ()'
  `-CompoundStmt 0x3f561d18 <col:12, line:4:1>
    `-CXXFunctionalCastExpr 0x3f561cf0 <line:3:6, col:9> 'N::S<int>' functional cast to N::S <ConstructorConversion>
      `-CXXConstructExpr 0x3f561b60 <col:6, col:9> 'N::S<int>' 'void (int)'
        `-IntegerLiteral 0x3f53d7a8 <col:8> 'int' 0

(which trips up one of the LibreOffice Clang plugins).

@mizvekov: I assume this is related to recent 91cdd35 "[clang] Improve nested name specifier AST representation (#147835)".

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions