[Issue 6940] New: immutable(int*)* and int** do not combine

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 12 13:35:36 PST 2011


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

           Summary: immutable(int*)* and int** do not combine
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2011-11-12 13:34:54 PST ---
immutable(int*)* and int** do not combine even though const(int*)* would be a
common type:

immutable(int*)*    x;
int**               y;

static assert(is(typeof(x) : const(int*)*)); // ok
static assert(is(typeof(y) : const(int*)*)); // ok
static assert(is(typeof(1?x:y)));            // fail


Compare to dynamic arrays:

immutable(int[])[]  a;
int[][]             b;

static assert(is(typeof(a) : const(int[])[])); // ok
static assert(is(typeof(b) : const(int[])[])); // ok
static assert(is(typeof(1?a:b)));              // ok

(why on earth do the two cases use different logic?)

Therefore the following could be used as a workaround:

static assert(is(typeof((1?x[0..1]:y[0..1]).ptr)));

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