Skip to content

Commit

Permalink
Merge pull request #2032 from 9rnsr/fix10076
Browse files Browse the repository at this point in the history
[REG2.060] fix Issue 10076 - expression.c:4310: virtual Expression* TypeExp::semantic(Scope*): Assertion `0' failed.
  • Loading branch information
yebblies committed May 14, 2013
2 parents 4ed3396 + 1de9770 commit 61bcb35
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mtype.c
Expand Up @@ -6486,6 +6486,7 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc,
}
if (t->ty == Tinstance && t != this && !t->deco)
{ error(loc, "forward reference to '%s'", t->toChars());
*pt = Type::terror;
return;
}

Expand All @@ -6505,6 +6506,7 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc,
{
if (!scx)
{ error(loc, "forward reference to '%s'", t->toChars());
*pt = Type::terror;
return;
}
if (scx->scopesym == scopesym)
Expand Down
28 changes: 28 additions & 0 deletions test/fail_compilation/ice10076.d
@@ -0,0 +1,28 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice10076.d(21): Error: template instance getMembersAndAttributesWhere!() template 'getMembersAndAttributesWhere' is not defined
fail_compilation/ice10076.d(26): Error: template instance ice10076.getValidaterAttrs!(string) error instantiating
fail_compilation/ice10076.d(16): instantiated from here: validate!(string)
fail_compilation/ice10076.d(26): Error: forward reference to 'getMembersAndAttributesWhere!().Elements'
fail_compilation/ice10076.d(26): Error: forward reference to 'getMembersAndAttributesWhere!().Elements'
fail_compilation/ice10076.d(16): Error: template instance ice10076.validate!(string) error instantiating
---
*/

void main()
{
string s;
validate(s);
}

template getValidaterAttrs(T)
{
alias getMembersAndAttributesWhere!().Elements getValidaterAttrs;
}

void validate(T)(T)
{
alias getValidaterAttrs!T memberAttrs;
auto x = memberAttrs.length;
}

0 comments on commit 61bcb35

Please sign in to comment.