Thread overview
[Issue 963] New: tuples & array literals: Error: non-constant expression ["abc","1"]
Feb 15, 2007
d-bugmail
Feb 18, 2007
d-bugmail
Jul 01, 2007
d-bugmail
Jul 23, 2007
d-bugmail
February 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=963

           Summary: tuples & array literals: Error: non-constant expression
                    ["abc","1"]
           Product: D
           Version: 1.005
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


# template A(T ...){
#    static assert(2 == T[0].length);
#    static assert("abc" == T[0][0]);
#    static assert("1" == T[0][1]);
#    const A = T[0];
# }
#
# mixin A!(["abc", "1"]);

Strange, all static asserts pass but "const A = T[0];" fails:

a.d(8): Error: non-constant expression ["abc","1"]


-- 

February 18, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=963


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement




------- Comment #1 from bugzilla@digitalmars.com  2007-02-18 03:07 -------
Array literals are currently evaluated at runtime, hence they are not constant expressions.


-- 

July 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=963


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from bugzilla@digitalmars.com  2007-07-01 01:17 -------
Works with DMD 1.017 and DMD 2.001


-- 

July 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=963





------- Comment #3 from thomas-dloop@kuehne.cn  2007-07-23 14:55 -------
Added to DStress as http://dstress.kuehne.cn/compile/t/tuple_26_A.d


--