`-ast-print` drops namespace qualifier from conversion operator's target type
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
`clang -Xclang -ast-print` for:
```cpp
namespace ns_will_be_dropped {
template struct tp {
};
}
template auto f(T t) {
return t.operator ns_will_be_dropped::tp();
}
```
drops the namespace qualifier from the conversion operator's target type ([clang-22](https://godbolt.org/z/jWq19ehfs)):
```cpp
namespace ns_will_be_dropped {
template struct tp {
};
}
template auto f(T t) {
return t.operator tp(); // <-- no namespace here
}
```
The resulting code does not compile: [clang-22](https://godbolt.org/z/W3xajdKKa)
Contributor guide
Research direction
Start by running the reduced C++ example with clang -Xclang -ast-print and compare the printed conversion operator target type with the source. Trace the AST-printing path for conversion operators and templates; done means the namespace qualifier is retained and the printed result compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100