Permalink
Browse files

Merge pull request #1434 from 9rnsr/fix9268

Issue 9268 - [ice-on-invalid] void assignment in fail44.d no longer caught in frontend
  • Loading branch information...
2 parents 870bc86 + fb98b5f commit 18e34e9d11f00d7078d13033d9845803eeb59027 @don-clugston-sociomantic don-clugston-sociomantic committed Jan 7, 2013
Showing with 18 additions and 7 deletions.
  1. +2 −2 src/expression.c
  2. +6 −2 test/d_do_test.d
  3. +10 −3 test/fail_compilation/fail44.d
View
@@ -10624,13 +10624,13 @@ Expression *AssignExp::semantic(Scope *sc)
Type *t1 = e1->type->toBasetype();
e2 = e2->inferType(t1);
- if (!e2->rvalue())
- return new ErrorExp();
e2 = e2->semantic(sc);
if (e2->op == TOKerror)
return new ErrorExp();
e2 = resolveProperties(sc, e2);
+ if (!e2->rvalue())
+ return new ErrorExp();
/* Rewrite tuple assignment as a tuple of assignments.
*/
View
@@ -417,10 +417,14 @@ int main(string[] args)
}
}
+ compile_output = std.string.strip(compile_output);
+ compile_output = compile_output.unifyNewLine();
+
+ auto m = std.regex.match(compile_output, `Internal error: .*$`);
+ enforce(!m, m.hit);
+
if (testArgs.compileOutput !is null)
{
- compile_output = std.string.strip(compile_output);
- compile_output = compile_output.unifyNewLine();
compile_output = std.regex.replace(compile_output, regex(`DMD v2\.[0-9]+ DEBUG\n`, ""), "");
compile_output = std.regex.replace(compile_output, regex(`\nDMD v2\.[0-9]+ DEBUG`, ""), "");
enforce(compile_output == testArgs.compileOutput,
@@ -1,12 +1,19 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail44.d(18): Error: expression bar[i] is void and has no value
+---
+*/
+
void Foo()
{
void[] bar;
void[] foo;
-
+
bar.length = 50;
foo.length = 50;
-
- for(int i=0; i<50; i++)
+
+ for(size_t i=0; i<50; i++)
{
foo[i] = bar[i];
}

0 comments on commit 18e34e9

Please sign in to comment.