Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue 9278 - ICE todt.c:692 when float containing struct is defined after use #1452

Merged
merged 1 commit into from

2 participants

@WalterBright WalterBright merged commit dabff86 into D-Programming-Language:master

1 check passed

Details default Pass: 10
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 9, 2013
  1. @9rnsr
This page is out of date. Refresh to see the latest.
View
6 src/mtype.c
@@ -8154,6 +8154,7 @@ Expression *TypeStruct::defaultInitLiteral(Loc loc)
for (size_t j = 0; j < structelems->dim; j++)
{
VarDeclaration *vd = sym->fields[j];
+ Type *telem = vd->type->addMod(this->mod);
Expression *e;
if (vd->init)
{ if (vd->init->isVoidInitializer())
@@ -8164,7 +8165,10 @@ Expression *TypeStruct::defaultInitLiteral(Loc loc)
else
e = vd->type->defaultInitLiteral(loc);
if (e && vd->scope)
- e = e->semantic(vd->scope);
+ {
+ e = e->semantic(vd->scope);
+ e = e->implicitCastTo(vd->scope, telem);
+ }
(*structelems)[j] = e;
}
StructLiteralExp *structinit = new StructLiteralExp(loc, (StructDeclaration *)sym, structelems);
View
16 test/compilable/test9278a.d
@@ -0,0 +1,16 @@
+// PREMUTE_ARGS:
+
+// Works fine here
+struct datum { float num = 0.0; }
+
+datum emitOne()
+{
+ datum t;
+ return t;
+}
+const dataArr = [emitOne()];
+
+// A very bad day
+//struct datum { float num = 0.0; }
+
+void main(){}
View
16 test/compilable/test9278b.d
@@ -0,0 +1,16 @@
+// PREMUTE_ARGS:
+
+// Works fine here
+//struct datum { float num = 0.0; }
+
+datum emitOne()
+{
+ datum t;
+ return t;
+}
+const dataArr = [emitOne()];
+
+// A very bad day
+struct datum { float num = 0.0; }
+
+void main(){}
Something went wrong with that request. Please try again.