D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7187 - Regression(head 12d62ca5): [CTFE] ICE on slicing
Summary: Regression(head 12d62ca5): [CTFE] ICE on slicing
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-12-30 21:57 UTC by Denis Shelomovskii
Modified: 2012-01-14 17:40 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 Denis Shelomovskii 2011-12-30 21:57:23 UTC
It compiles with dmd 2.057. But with head commit (12d62ca5):
Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6315 in file 'interpret.c'
---
int[] f() { return [0]; }

int g(int[] r)
{
    auto t = r[0..0];
    return 0;
}

static assert(g(f()) == 0);
---
Comment 2 Denis Shelomovskii 2011-12-31 23:59:25 UTC
If an argument is added to `f` with head commit (227769c4):
Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6307 in file 'interpret.c'
---
int[] f(int) { return [0]; }

int g(int[] r)
{
    auto t = r[0..0];
    return 0;
}

static assert(g(f(0)) == 0);
---
Comment 4 Denis Shelomovskii 2012-01-08 05:49:39 UTC
If const cast and struct are added, with head commit (d2b8eadf):
Assertion failure: '((ArrayLiteralExp *)se->e1)->ownedByCtfe' on line 6337 in file 'interpret.c'
---
struct S { const(int)[] field; }

const(int)[] f() {
    int[] arr = [];
    const(int)[] str = arr;
    auto s = S(str);
    return s.field;
}

int g(const(int)[] r)
{
    auto t = r[0..0];
    return 0;
}

static assert(g(f()) == 0);
---

This affects Appender using with CTFE.