Skip to content

Commit

Permalink
fix Issue 13385 - ICE with new package(names) protection
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Aug 28, 2014
1 parent 1f8280c commit fe707eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/attrib.c
Expand Up @@ -600,11 +600,11 @@ void ProtDeclaration::semantic(Scope* sc)

if ((protection.kind == PROTpackage) && (protection.pkg != NULL) && sc->module)
{
Package* pkg = sc->module->parent->isPackage();
assert(pkg);
if (pkg && !protection.pkg->isAncestorPackageOf(pkg))
Module *m = sc->module;
Package* pkg = m->parent ? m->parent->isPackage() : NULL;
if (!pkg || !protection.pkg->isAncestorPackageOf(pkg))
error("does not bind to one of ancestor packages of module '%s'",
sc->module->toPrettyChars(true));
m->toPrettyChars(true));
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/fail_compilation/ice13385.d
@@ -0,0 +1,9 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice13385.d(9): Error: protection attribute 'package(a)' does not bind to one of ancestor packages of module 'ice13385'
---
*/
module ice13385;

package(a) void foo() {}

0 comments on commit fe707eb

Please sign in to comment.