This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14007] [3.3/3.4/3.5 Regression] Incorrect use of const partial specialization for reference template argument
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Mar 2004 17:34:13 -0000
- Subject: [Bug c++/14007] [3.3/3.4/3.5 Regression] Incorrect use of const partial specialization for reference template argument
- References: <20040203195712.14007.austern@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-03-19 17:34 -------
Without commenting on the function-type issues, I'll note that Nathan's argument
now makes sense to me. Here is another way to approach it.
Given
template <typename T> struct X {}; // #1
template <typename T> struct X<const T>; //#2
template struct X<int&>; //#3
the only issue is whether #2 matches #3. If so, then it is clearly the most
specialized and is the one selected.
Presumably, 14.8.2/2 -- which is written for function templates, but makes sense
for explicitly specified class template arguments as well -- applies. It lists
the cases in which deduction fails because an invalid type is created -- and
creating a cv-qualified reference type is not among them. As Nathan notes,
8.3.2 explicitly allows cv-qualified reference types in this situation.
(Clearly, this example:
template <typename T> void f(const T) {}
template void f<int&>(int &);
is valid.)
I'm therefore closing this as INVALID.
Nathan, Matt -- if y'all thing this is the wrong behavior, would you please
submit a DR?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14007