[Issue 16107] New: [ICE] - Internal error: backend/cgcod.c 2297
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue May 31 21:33:19 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16107
Issue ID: 16107
Summary: [ICE] - Internal error: backend/cgcod.c 2297
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
The following code, compiled with DMD 2.071.1-b2 crashes the compiler:
===============================================
import std.stdio, std.traits;
struct TreeItemChildren(T){}
struct TreeItemSiblings(T){}
class Foo
{
enum isStruct = is(typeof(this) == struct);
static if (isStruct)
alias TreeItemType = typeof(this)*;
else
alias TreeItemType = typeof(this);
TreeItemSiblings!TreeItemType _siblings; // remove this decl
TreeItemChildren!TreeItemType _children; // or this one : OK
}
template Bug(T)
{
bool check()
{
bool result;
import std.meta: aliasSeqOf;
import std.range: iota;
foreach(i; aliasSeqOf!(iota(0, T.tupleof.length)))
{
alias MT = typeof(T.tupleof[i]);
static if (is(MT == struct))
result |= Bug!MT; // result = result | ... : OK
if (result) break; // remove this line : OK
}
return result;
}
enum Bug = check();
}
void main()
{
assert(!Bug!Foo);
}
===============================================
produces
> Internal error: backend/cgcod.c 2297
The comments in the code indicates each time that the bug doesn't happen when
the stuff is commented.
--
More information about the Digitalmars-d-bugs
mailing list