[Issue 9818] New: Constant folding for static array does not work with initializing by element
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 26 07:32:33 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9818
Summary: Constant folding for static array does not work with
initializing by element
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-26 07:32:31 PDT ---
Test case:
static const int[3] sa1 = 1;
pragma(msg, "sa1: ", sa1); // doesn't work
static assert(sa1 == [1, 1, 1]); // doesn't work
enum int[3] ea1 = 1;
pragma(msg, "ea1: ", ea1); // prints "1" - bad
static assert(ea1 == [1, 1, 1]); // doesn't work
struct X
{
static const int[3] sa2 = 1;
pragma(msg, "sa2: ", sa1); // doesn't work
static assert(sa2 == [1, 1, 1]); // doesn't work
enum int[3] ea2 = 1;
pragma(msg, "ea2: ", ea2); // prints "1" - bad
static assert(ea2 == [1, 1, 1]); // doesn't work
}
void test()
{
static const int[3] sa3 = 1;
pragma(msg, "sa3: ", sa3); // doesn't work
static assert(sa3 == [1, 1, 1]); // doesn't work
enum int[3] ea3 = 1;
pragma(msg, "ea3: ", ea3); // prints "1" - bad
static assert(ea3 == [1, 1, 1]); // doesn't work
struct Y
{
static const int[3] sa4 = 1;
pragma(msg, "sa4: ", sa4); // doesn't work
static assert(sa4 == [1, 1, 1]); // doesn't work
enum int[3] ea4 = 1;
pragma(msg, "ea4: ", ea4); // prints "1" - bad
static assert(ea4 == [1, 1, 1]); // doesn't work
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list