D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7785 - [CTFE] ICE when slicing pointer to variable
Summary: [CTFE] ICE when slicing pointer to variable
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: CTFE, pull
Depends on:
Blocks:
 
Reported: 2012-03-26 20:02 UTC by Martin Nowak
Modified: 2012-04-03 00: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 Martin Nowak 2012-03-26 20:02:09 UTC
cat > bug.d << CODE
bool foo()
{
    int val;
    auto p = &val;
    auto ary = p[0 .. 1];
    return true;
}

enum res = foo();
CODE

dmd -c bug

--------
Comment 1 Don 2012-03-30 06:12:23 UTC
It also applies to indexing, and assignment to slices and indices:


    int val = 7;
    auto p = &val;
    auto ary = p[0 .. 1]; // ICE 1
    auto x = p[0];        // ICE 2
    p[0..1] = 1;          // ICE 3
    p[0] = 6;             // ICE 4

This pull request turns ICE 1 and ICE 3 into sensible error messages;
ICE 2 compiles without error (it only generates an error, if index is non-zero)
ICE 4 generates a "not yet implemented" error.

https://github.com/D-Programming-Language/dmd/pull/851
Comment 2 github-bugzilla 2012-03-30 21:31:30 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bd6b7d24dc856ac77500179055db521bf3a71825
Merge pull request #851 from donc/ctfe7785pointerToVar

Fix issue 7785 [CTFE] ICE when slicing pointer to variable