[Bug c++/99686] ICE when using both concepts and full specialization
webrown.cpp at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 25 12:32:50 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99686
--- Comment #4 from W E Brown <webrown.cpp at gmail dot com> ---
(In reply to Steven Sun from comment #3)
> .... I would expect the complete specialization is full
> specialization for both primary templates.
No, any given explicit or partial specialization can be a specialization of
only one primary template. (Suppose that two overloaded primary templates had
different signatures. How then, in general, could both be specialized by any
single explicit or partial specialization?)
> ...
> In conclusion, this makes sences but I didn't see that coming. Anyway, I
> think a possible improvement is make ICE to an error of "ambigous full
> specialization". Or even better, a change in C++23 standard.
Given two or more very similar primary templates, C++ already specifies an
algorithm (known as "partial* ordering") to determine which one is being
specialized by a given explicit or partial specialization. Therefore, unless
you can find some issue with that algorithm, I see no reason to propose any
language change in this area; partial ordering has been part of C++ for several
decades.
(However, I speculate that your test cases may have exposed a bug in GCC's
implementation of partial ordering, possibly just a failure to diagnose an
ambiguous situation. I'm sure the GCC internals experts will provide proper
diagnosis and remediation in due course.)
* The algorithn is termed "partial" because there are cases that can't be
decided and therefore result in an ill-formed program. If you'd like some
further details on this topic, I can recommend my video 😊
https://www.youtube.com/watch?v=nfIX8yWlByY.
More information about the Gcc-bugs
mailing list