[llvm-bugs] [Bug 50774] New: Clang AST ignores PrintingPolicy for template specialization
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jun 19 11:17:21 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50774
Bug ID: 50774
Summary: Clang AST ignores PrintingPolicy for template
specialization
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: nuttyrunner at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
The problem is regarding clang AST - TypePrinter.cpp here
https://searchfox.org/llvm/rev/cbfb12469ba312c8ff513397b29bef470f151caa/clang/lib/AST/TypePrinter.cpp#1460
always resets full qualification to false (the last argument), thus it is
impossible to print clang::ParmVarDecl::getType() from a
ClassTemplateSpecializationDecl with the namespace the parameter type is
declared in. So for code below getAsString() of the param type returns
"Type<int>" instead of "Namespace::Type<int>", and there is no way to get the
latter as the result (PrintingPolicy is ignored for the template-id codepath).
namespace Namespace {
template<typename T>
struct Type {
T Field;
}
template<typename T>
struct Struct {
void Func(const Type<T> &InType) {
}
}
int main() {
Struct<int> Instance;
}
}
Problem found thanks to the help of user nridge in discord.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210619/aa62c497/attachment.html>
More information about the llvm-bugs
mailing list