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 ***