[Issue 8848] New: Array literals and AA literals are rejected as template value parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 18 02:41:21 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8848

           Summary: Array literals and AA literals are rejected as
                    template value parameters
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2012-10-18 02:41:18 PDT ---
The template spec says that they are valid (both D1 and D2), but

template Bleherg(int[int] X) {}

gives:

bug.d(1): Error: arithmetic/string type expected for value-parameter, not
int[int]
---
However, the compiler accepts them as template value parameters when used with
in a tuple argument. The example below works correctly with both D1 and D2.
-----
class C ( T ... )
{
    pragma(msg, "The keys are   ", T[0].keys);
    pragma(msg, "The values are ", T[0].values);
}

alias C!( [ "abc"[] : 73, "sdg":6 ] ) G1;
alias C!( [ 22354.56 : 273, 43565.12:96 ] ) G2;
-----
Additionally, the name mangling for both array literals and AA literals is
clearly documented in the spec ABI page.

The error message is erroneous.

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