This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13640] Failing to reject class template partial specialization which can never be selected
- From: "theodore dot papadopoulo at sophia dot inria dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2004 19:49:47 -0000
- Subject: [Bug c++/13640] Failing to reject class template partial specialization which can never be selected
- References: <20040110200828.13640.giovannibajo@libero.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From theodore dot papadopoulo at sophia dot inria dot fr 2004-01-15 19:49 -------
Subject: Re: Failing to reject class template partial specialization which can never be selected
[Sorry, late reply]
The only thing I can add is that it is extremely awkward for a user
to have a piece of code that is accepted by the compiler (as I
understand it should do) and that is silently discarded (this is not
what is done but the observed behaviour is the same).
I understand that emitting the warning might be costly, but emitting
nothing is very error prone and confusing.
The following is pure speculation but I assume there are two ways of
implementing the warning:
- Make the check when the template specialization is parsed. Here I
think I understand that we do not want the partial ordering to be done.
- Make the check when one tries to instantiate the template. At this
point, the partial ordering of the specialization has anyway to be
done if I understand correctly, so emitting a warning at this stage
should not be very costly. The warning would only be emitted when an
attempt to use the code is made and not otherwise, but that should be
both cost effective and non surprising as one is used to not have
full error messages on template classes as long as those are not used.
All that being said, I still believe that this is a quite annoying
limitation in C++ and one that cannot be overcomed easily. But this
is not the topic here.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13640