https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81043

Mike Detwiler <shazamancan at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |shazamancan at gmail dot com

--- Comment #2 from Mike Detwiler <shazamancan at gmail dot com> ---
I would like to share a temporary workaround that I have developed for this.
Consider the usual pattern for writing a partial specialization:

original decl:

template<ORIGINAL_PARAMS>
class my_class;

specialization:

template<SPECIAL_PARAMS>
class my_class<MODIFIED_PARAMS>;

If ORIGINAL_PARAMS, SPECIAL_PARAMS, and MODIFIED_PARAMS are all identical, then
it is an error, as it should be. Example of a true error:

template<typename T>
class my_class;

template<typename T> // <-- identical to ORIGINAL_PARAMS
class my_class<T>; // <-- T is unmodified, so MODIFIED_PARAMS is also identical

All three *PARAMS are identical, so it is an error. Example of a true
non-error:

template<typename T>
class my_class;

template<typename T> // <-- identical to ORIGINAL_PARAMS
class my_class<T*>; // <-- T is modified, so MODIFIED_PARAMS is NOT identical

Not all three *PARAMS are identical, so it is not an error. Another example of
a true non-error:

template <typename T> concept C = (sizeof(T) <= 4);

template<typename T>
class my_class;

template<C T> // <-- NOT identical to ORIGINAL_PARAMS (typename vs C)
class my_class<T>; // <-- T is unmodified, so MODIFIED_PARAMS is also identical

Reply via email to