[Bug c++/14007] [3.3/3.4/3.5 Regression] Incorrect use of const partial specialization for reference template argument
mmitchel at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Mar 19 17:34:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list