-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
Given
template <class... T, unsigned N>
auto foo(T ...params) {
return params...[N];
}Running clang -std=c++2c -fsyntax-only -Xclang -ast-print on it results in
template <class ...T, unsigned int N> auto foo(T ...params) {
return 0xd3cffc0...[0xd3cffe0];
}
https://compiler-explorer.com/z/czchqqj1s
The cause is due to the inadvertent use of operator << in clang/lib/AST/StmtPrinter.cpp:
llvm-project/clang/lib/AST/StmtPrinter.cpp
Lines 2519 to 2521 in e508bac
| void StmtPrinter::VisitPackIndexingExpr(PackIndexingExpr *E) { | |
| OS << E->getPackIdExpression() << "...[" << E->getIndexExpr() << "]"; | |
| } |
Any PackIndexingExpr would be printed as their addresses rather than intelligible source codes, contrary to the behavior for any other expressions.
We should use PrintExpr() anyway.
cor3ntin
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute