<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 7, 2014 at 4:14 PM, Nikola Smiljanic <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Anton, and welcome! Richard (CCed) will tell us if this is indeed a clang bug.</div></blockquote><div><br></div><div>It would definitely be good to diagnose this case.</div><div><br></div><div>In addition to Nikola's comments:</div><div><br></div><div><div>+      if (!DeduceTemplateArguments(ThisPartialSpec,</div><div>+                                      S->getTemplateArgs(),</div><div>+                                      Info) &&</div><div>+          S->getSpecializationKind() != TSK_ExplicitSpecialization) {</div></div><div><br></div><div>Please reverse the order of these two checks; the second check is vastly cheaper than the first one. You should also skip specializations that have not been instantiated here; this is fine:</div><div><br></div><div>  template<typename T> struct S;</div><div>  S<int*> *p;</div><div>  template<typename T> struct S<T*> {};</div><div><br></div><div>... because the second line does not trigger the instantiation of S<int*>.</div><div><br></div><div>+          return true;<br></div><div><br></div><div>We should carry on and produce the declaration in this case.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I can give you some general comments in the meantime:<div><br></div><div>Patches that need review are sent to cfe-commits or attached to Phabricator (code review tool we use). They mostly go unnoticed in bugzilla.</div><div><br></div><div>Please use clang-format to format the code.</div><div><br></div><div>We'll need a test for this. It's also a good practice to provide a code sample that demonstrates the issue when reporting a bug (this is what usually ends up being your test). Have a look at existing test infrastructure, namely -verify switch and expected-error "annotation". The test should probably go to test/SemaTemplate/temp_class_spec.cpp</div><div><br></div><div>auto const ThisPartialSpec should be const auto *ThisPartialSpec<br></div><div><br></div><div>auto InstantiatedFrom should be auto *InstantiatedFrom<br></div><div><br></div><div>Other than that your code looks good, but I can't really comment on the logic.</div><span class=""><font color="#888888"><div><br></div><div>Nikola</div><div><br></div></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 11:45 PM, Anton Bikineev <span dir="ltr"><<a href="mailto:ant.bikineev@gmail.com" target="_blank">ant.bikineev@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,<br>
<br>
I'm sorry to partially duplicate this post from cfe-commits,<br>
but probably that was wrong place to ask this question.<br>
<br>
I recently found that Clang doesn't behave similiar as GCC<br>
in case of partial specialization ater implicit or explicit<br>
specialization of class template. GCC gives diagnostic like<br>
<br>
"error: partial specialization of 'A<const T*>' after instantiation of<br>
'A<const char*>'"<br>
<br>
while Clang just ignores it and instantiates previously declared<br>
templates by lookup. I looked over the Standard and found:<br>
<br>
C++ [temp.class.spec]p1:<br>
"A partial specialization shall be declared before the first<br>
use of a class template specialization that would make use of<br>
the partial specialization as the result of an implicit or explicit<br>
instantiation in every translation unit in which such a use occurs;<br>
no diagnostic is required."<br>
<br>
So it seems to me that GCC has a right behaviour for this. I also<br>
submitted a bug <a href="http://llvm.org/bugs/show_bug.cgi?id=21156" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=21156</a> and<br>
wrote a patch, which I attached to bug. I just was wondering,<br>
does this patch really make sense? I'm newbie in Clang and my code<br>
may be incorrect but I would be extremely thankful if someone<br>
could review it (if it really makes sense).<br>
<br>
I'm also not sure, probably Clang has its own politics for this.<br>
If so, what is a reason of such behavior?<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>