Movatterモバイル変換


[0]ホーム

URL:


Issue 100 - WG21 CWG Issues
Title
Clarify why string literals are not allowed as template arguments
Status
tc1
Section
13.4.3 [temp.arg.nontype]
Submitter
Mike Miller

Created on1999-03-09.00:00:00 last changed277 months ago

Messages

msg87 (view)
Date: 1999-10-15.00:00:00

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 acceptabletemplate-argument because a string literal is an objectwith internal linkage.
to
[Note: a string literal(5.13.5 [lex.string]) does not satisfy therequirements of any of these categories and thus is not anacceptabletemplate-argument.
msg86 (view)
Date: 2022-11-20.07:54:16

The explanation in13.4.3 [temp.arg.nontype]paragraph 2 of why a string literal cannot beused 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 hasinternal linkage. In fact, I'd be pretty surprised if I did,since linkage is defined (in6.7 [basic.link]) strictly in terms ofnames, and a string literal doesn't have a name.Actually, I think that it's the namelessness of a string literalthat prevents it from being a template argument; only thethird and fourth bullets of13.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 anid-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 acceptabletemplate-argument because a string literal is an objectwith internal linkage.
to
[Note: a string literal(5.13.5 [lex.string]) does not satisfy therequirements of any of these categories and thus is not anacceptabletemplate-argument.
History
DateUserActionArgs
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-02-23 00:00:00adminsetstatus: ready -> dr
1999-09-14 00:00:00adminsetmessages: +msg87
1999-03-09 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp