<div dir="ltr">Hi<div><br></div><div>Consider the following C++ code: </div><div><br></div><div><div>template<typename T, typename U = int ></div><div>class Test { };</div><div>template class Test<float>;</div><div>// Test<float> v;</div><div><br></div><div>And my visitor for the <font face="arial, helvetica, sans-serif" color="#000000" style="background-color:rgb(255,255,255)">ClassTemplateSpecializationDecl </font><span style="color:black;font-family:Consolas">does the following: </span></div><div><span style="color:black;font-family:Consolas"><br></span></div><div><pre style="background-image:initial;background-repeat:initial"><font face="arial, helvetica, sans-serif" style="background-color:rgb(255,255,255)" color="#000000">clang::LangOptions langOpts;
langOpts.CPlusPlus = true;
clang::PrintingPolicy policy(langOpts);
</font><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">clang</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">::</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">QualType</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">qualifiedType</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> = </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">astcontex</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">.</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">getRecordType</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">(</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">decl</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">);
</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">std</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">::</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">string</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">name</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> = </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">qualifiedType</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">.</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">getAsString</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">(</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">policy</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">);</span></pre><pre style="background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">With the code above, I get: </span></pre><pre style="background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">Test<float></span></pre><pre style="background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">Now, comment line 3 and uncomment line 4, and you get: </span></pre><pre style="background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">Test<float, int></span></pre><pre style="background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">First, is this intentional? Second, f</span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">or the clang tool I'm writing, I need the second version (full specification) always. Is there a way to achieve this? </span></pre><pre style="background-image:initial;background-repeat:initial"><font color="#000000" face="arial, helvetica, sans-serif">Thank you</font></pre><pre style="background-image:initial;background-repeat:initial"><font color="#000000" face="arial, helvetica, sans-serif">Benjamin Schindler</font></pre></div><div dir="ltr"><p style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"></p></div>
</div></div>