This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See for the official list.


100. Clarify why string literals are not allowed as template arguments

Section: 13.4.3  [temp.arg.nontype]     Status: TC1     Submitter: Mike Miller     Date: 9 Mar 1999

The explanation in 13.4.3 [temp.arg.nontype] paragraph 2 of why a string literal cannot be used as a template argument leaves something to be desired:

...because a string literal is an object with internal linkage.
I can't find anything that says that a string literal has internal linkage. In fact, I'd be pretty surprised if I did, since linkage is defined (in 6.6 [] ) strictly in terms of names, and a string literal doesn't have a name. Actually, I think that it's the namelessness of a string literal that prevents it from being a template argument; only the third and fourth bullets of 13.4.3 [temp.arg.nontype] paragraph 1 could conceivably apply, and both of those require that the entity have a name (i.e., that they be given as an id-expression).

Proposed Resolution (10/99): In 13.4.3 [temp.arg.nontype] paragraph 2, change

[Note: a string literal (5.13.5 [lex.string] ) is not an acceptable template-argument because a string literal is an object with internal linkage.
[Note: a string literal (5.13.5 [lex.string] ) does not satisfy the requirements of any of these categories and thus is not an acceptable template-argument.