Title
"depends" poorly defined in 17.4.3.1
Status
cd1
Section
[reserved.names]
Submitter
Peter Dimov

Created on 2000-04-18.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

[ post-Toronto: Judy provided the above proposed resolution and rationale. ]

Date: 2010-10-21.18:28:33

[ Toronto: this may be related to issue 120. ]

Date: 2010-10-21.18:28:33

Rationale:

This terminology is used in section 2.5.2 and 4.1.1 of The C++ Programming Language. It disallows the example in the issue, since the underlying type itself is not user-defined. The only possible problem I can see is for non-type templates, but there's no possible way for a user to come up with a specialization for bitset, for example, that might not have already been specialized by the implementor?

Date: 2010-10-21.18:28:33

Proposed resolution:

Change "user-defined name" to "user-defined type".

Date: 2000-04-18.00:00:00

17.4.3.1/1 uses the term "depends" to limit the set of allowed specializations of standard templates to those that "depend on a user-defined name of external linkage."

This term, however, is not adequately defined, making it possible to construct a specialization that is, I believe, technically legal according to 17.4.3.1/1, but that specializes a standard template for a built-in type such as 'int'.

The following code demonstrates the problem:

#include <algorithm>
template<class T> struct X
{
 typedef T type;
};
namespace std
{
 template<> void swap(::X<int>::type& i, ::X<int>::type& j);
}
History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1947
2010-10-21 18:28:33adminsetmessages: + msg1946
2010-10-21 18:28:33adminsetmessages: + msg1945
2010-10-21 18:28:33adminsetmessages: + msg1944
2000-04-18 00:00:00admincreate