Skip to content

Commit

Permalink
Merge pull request #4819 from 9rnsr/fix1747_2013
Browse files Browse the repository at this point in the history
Issue 1747 & 2013 - class/interface cast is incorrect in some cases
  • Loading branch information
rainers committed Jul 19, 2015
2 parents 80a326e + 023a3ae commit f78b25c
Show file tree
Hide file tree
Showing 12 changed files with 205 additions and 118 deletions.
8 changes: 4 additions & 4 deletions src/access.c
Expand Up @@ -63,7 +63,7 @@ Prot getAccess(AggregateDeclaration *ad, Dsymbol *smember)
{
BaseClass *b = (*cd->baseclasses)[i];

Prot access = getAccess(b->base, smember);
Prot access = getAccess(b->sym, smember);
switch (access.kind)
{
case PROTnone:
Expand Down Expand Up @@ -130,9 +130,9 @@ static bool isAccessible(
for (size_t i = 0; i < cdthis->baseclasses->dim; i++)
{
BaseClass *b = (*cdthis->baseclasses)[i];
Prot access = getAccess(b->base, smember);
Prot access = getAccess(b->sym, smember);
if (access.kind >= PROTprotected ||
isAccessible(smember, sfunc, b->base, cdscope))
isAccessible(smember, sfunc, b->sym, cdscope))
{
return true;
}
Expand All @@ -148,7 +148,7 @@ static bool isAccessible(
for (size_t i = 0; i < cdthis->baseclasses->dim; i++)
{
BaseClass *b = (*cdthis->baseclasses)[i];
if (isAccessible(smember, sfunc, b->base, cdscope))
if (isAccessible(smember, sfunc, b->sym, cdscope))
return true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/aggregate.h
Expand Up @@ -200,9 +200,9 @@ class UnionDeclaration : public StructDeclaration
struct BaseClass
{
Type *type; // (before semantic processing)
Prot protection; // protection for the base interface
Prot protection; // protection for the base interface

ClassDeclaration *base;
ClassDeclaration *sym;
unsigned offset; // 'this' pointer offset
FuncDeclarations vtbl; // for interfaces: Array of FuncDeclaration's
// making up the vtbl[]
Expand Down Expand Up @@ -284,6 +284,7 @@ class ClassDeclaration : public AggregateDeclaration
bool isFuncHidden(FuncDeclaration *fd);
FuncDeclaration *findFunc(Identifier *ident, TypeFunction *tf);
void interfaceSemantic(Scope *sc);
unsigned setBaseInterfaceOffsets(unsigned baseOffset);
bool isCOMclass();
virtual bool isCOMinterface();
bool isCPPclass();
Expand Down

0 comments on commit f78b25c

Please sign in to comment.