Skip to content

Commit

Permalink
fix Issue 15667 - dmd infinite loop on invalid syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Feb 16, 2016
1 parent 57592cf commit 354cca3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dmodule.d
Expand Up @@ -987,7 +987,7 @@ public:
for (size_t i = 0; i < members.dim; i++)
{
Dsymbol s = (*members)[i];
//printf("\tModule('%s'): '%s'.semantic()\n", toChars(), s->toChars());
//printf("\tModule('%s'): '%s'.semantic()\n", toChars(), s.toChars());
s.semantic(sc);
runDeferredSemantic();
}
Expand Down
2 changes: 1 addition & 1 deletion src/parse.d
Expand Up @@ -3277,7 +3277,7 @@ public:
break;
default:
error("basic type expected, not %s", token.toChars());
t = Type.tint32;
t = Type.terror;
break;
}
return t;
Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/fail15667.d
@@ -0,0 +1,13 @@
// REQUIRED_ARGS: -o-
/*
TEST_OUTPUT:
---
fail_compilation/imports/a15667.d(16): Error: basic type expected, not ;
fail_compilation/imports/a15667.d(19): Error: declaration expected following attribute, not EOF
---
*/

void main()
{
import imports.a15667;
}
18 changes: 18 additions & 0 deletions test/fail_compilation/imports/a15667.d
@@ -0,0 +1,18 @@
module imports.a15667;

template staticIndexOf(T)
{
enum staticIndexOf = genericIndexOf!T;
}

template genericIndexOf(args...)
{
alias e = args;
alias tuple = args;
alias tail = tuple;
enum next = genericIndexOf!(e, tail);
}

alias X = ;

static if (staticIndexOf!X)

0 comments on commit 354cca3

Please sign in to comment.