Skip to content

Commit

Permalink
Merge pull request #7199 from JinShil/fix_17307
Browse files Browse the repository at this point in the history
Fix Issue 17307 - [REG2.072.0][ICE] TypeBasic::implicitConvTo
  • Loading branch information
WalterBright authored Oct 11, 2017
2 parents 75da138 + 0cd20c3 commit bf5a755
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ddmd/attrib.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ extern (C++) abstract class AttribDeclaration : Dsymbol

Dsymbols* include(Scope* sc, ScopeDsymbol sds)
{
if (errors)
return null;

return decl;
}

Expand Down Expand Up @@ -802,6 +805,7 @@ extern (C++) final class AnonDeclaration : AttribDeclaration
if (!ad)
{
.error(loc, "%s can only be a part of an aggregate, not %s `%s`", kind(), p.kind(), p.toChars());
errors = true;
return;
}

Expand Down Expand Up @@ -1241,6 +1245,10 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
override Dsymbols* include(Scope* sc, ScopeDsymbol sds)
{
//printf("ConditionalDeclaration::include(sc = %p) scope = %p\n", sc, scope);

if (errors)
return null;

assert(condition);
return condition.include(_scope ? _scope : sc, sds) ? decl : elsedecl;
}
Expand Down Expand Up @@ -1317,6 +1325,10 @@ extern (C++) final class StaticIfDeclaration : ConditionalDeclaration
override Dsymbols* include(Scope* sc, ScopeDsymbol sds)
{
//printf("StaticIfDeclaration::include(sc = %p) scope = %p\n", sc, scope);

if (errors)
return null;

if (condition.inc == 0)
{
assert(scopesym); // addMember is already done
Expand Down Expand Up @@ -1442,6 +1454,9 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration

override Dsymbols* include(Scope* sc, ScopeDsymbol sds)
{
if (errors)
return null;

if (cached)
{
return cache;
Expand Down
12 changes: 12 additions & 0 deletions test/fail_compilation/test17307.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/test17307.d(9): Error: anonymous struct can only be a part of an aggregate, not module `test17307`
---
* https://issues.dlang.org/show_bug.cgi?id=17307
*/

struct { enum bitsPerWord = size_t; }

void main()
{ }

0 comments on commit bf5a755

Please sign in to comment.