D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7621 - Immutable type equivalence problem
Summary: Immutable type equivalence problem
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-03-01 13:14 UTC by bearophile_hugs
Modified: 2012-03-25 20:53 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2012-03-01 13:14:49 UTC
I don't understand this bug. D2 code:


void main() {
    enum uint N = 4u;
    char[] A = "hello".dup;
    uint[immutable char[N]] dict;
    dict[*cast(immutable char[4]*)(A[0 .. N].ptr)] = 0; // OK
    dict[*cast(immutable char[N]*)(A[0 .. N].ptr)] = 0; // line 6, error
}


DMD 2.059head gives:

test.d(6): Error: cannot implicitly convert expression (*cast(immutable(char[N]*))cast(char*)A[0u..4u]) of type immutable(char[N]) to immutable(char[4u])
Comment 2 github-bugzilla 2012-03-25 20:39:02 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/555bb0d25c908fb2811c665372510b529088c814
Merge pull request #838 from 9rnsr/fix7621

Issue 7621 - Immutable type equivalence problem