copy initialization of FieldDecl sometimes erroneously includes `= ` in source range
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Source ranges for the initialization expression in a FieldDecl is inconsistent with that from VarDecl when copy initialization is used in some circumstances, e.g.
https://gcc.godbolt.org/z/vPaY3dM13
```c++
struct D {};
struct S {
D d0;
D d1 = d0; // CXXConstructExpr("= d0")
D d2 = {d0}; // CXXConstructExpr("= {d0}")
D d3 = D{d0}; // CXXTemporaryObjectExpr("D{d0}")
D d4{d0}; // CXXConstructExpr("{d0}")
};
void fn() {
D d0;
D d1 = d0; // CXXConstructExpr("d0")
D d2 = {d0}; // CXXConstructExpr("{d0}")
D d3 = D{d0}; // CXXTemporaryObjectExpr("D{d0}")
D d4{d0}; // CXXConstructExpr("{d0}")
}
```
It seems to be limited to CXXConstructExpr, but I've not looked exhaustively.
Contributor guide
Assessment
This issue has not been assessed yet.