[cfe-dev] Partial specialization after implicit/explicit template instantiation.

Anton Bikineev ant.bikineev at gmail.com
Tue Oct 7 05:45:51 PDT 2014


Hi all,

I'm sorry to partially duplicate this post from cfe-commits,
but probably that was wrong place to ask this question.

I recently found that Clang doesn't behave similiar as GCC
in case of partial specialization ater implicit or explicit
specialization of class template. GCC gives diagnostic like

"error: partial specialization of 'A<const T*>' after instantiation of
'A<const char*>'"

while Clang just ignores it and instantiates previously declared
templates by lookup. I looked over the Standard and found:

C++ [temp.class.spec]p1:
"A partial specialization shall be declared before the first
use of a class template specialization that would make use of
the partial specialization as the result of an implicit or explicit 
instantiation in every translation unit in which such a use occurs;
no diagnostic is required."

So it seems to me that GCC has a right behaviour for this. I also
submitted a bug http://llvm.org/bugs/show_bug.cgi?id=21156 and
wrote a patch, which I attached to bug. I just was wondering,
does this patch really make sense? I'm newbie in Clang and my code
may be incorrect but I would be extremely thankful if someone
could review it (if it really makes sense).

I'm also not sure, probably Clang has its own politics for this.
If so, what is a reason of such behavior?





More information about the cfe-dev mailing list