Bug 2391 – Character array literals are not recognized as string literals

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-10-04T03:20:00Z
Last change time
2015-06-09T01:20:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
samukha
Blocks
1059

Comments

Comment #0 by samukha — 2008-10-04T03:20:58Z
pragma(msg, ['c']); test.d(7): pragma msg string expected for message, not '['c']' Also, __traits: ---- struct S { static int x; } void main() { S s; __traits(getMember, s, ['x']) = 1; } ---- test.d(15): Error: string expected as second argument of __traits getMember instead of ['x']
Comment #1 by samukha — 2008-10-04T04:10:53Z
In the above, S instance is unnecessary. Corrected: ---- struct S { static int x; } void main() { __traits(getMember, S, ['x']) = 1; } ----
Comment #2 by yebblies — 2011-06-30T00:34:35Z
This has the same cause as bug 2391: array literals are not accepted when a compile-time string is required. *** This issue has been marked as a duplicate of issue 2156 ***