<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang AST ignores PrintingPolicy for template specialization"
href="https://bugs.llvm.org/show_bug.cgi?id=50774">50774</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang AST ignores PrintingPolicy for template specialization
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nuttyrunner@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The problem is regarding clang AST - TypePrinter.cpp here
<a href="https://searchfox.org/llvm/rev/cbfb12469ba312c8ff513397b29bef470f151caa/clang/lib/AST/TypePrinter.cpp#1460">https://searchfox.org/llvm/rev/cbfb12469ba312c8ff513397b29bef470f151caa/clang/lib/AST/TypePrinter.cpp#1460</a>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>