mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Fixed a crash inside TraitsExp::semantic when compiling typecons.d with unittests
This commit is contained in:
@@ -961,7 +961,7 @@ int ClassDeclaration::isFuncHidden(FuncDeclaration *fd)
|
||||
for (size_t i = 0; i < os->a.dim; i++)
|
||||
{ Dsymbol *s2 = os->a.tdata()[i];
|
||||
FuncDeclaration *f2 = s2->isFuncDeclaration();
|
||||
if (f2 && overloadApply(getModule(), f2, &isf, fd))
|
||||
if (f2 && overloadApply(f2, &isf, fd))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -970,7 +970,7 @@ int ClassDeclaration::isFuncHidden(FuncDeclaration *fd)
|
||||
{
|
||||
FuncDeclaration *fdstart = s->isFuncDeclaration();
|
||||
//printf("%s fdstart = %p\n", s->kind(), fdstart);
|
||||
return !overloadApply(getModule(), fdstart, &isf, fd);
|
||||
return !overloadApply(fdstart, &isf, fd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -108,7 +108,7 @@ struct Match
|
||||
|
||||
void overloadResolveX(Match *m, FuncDeclaration *f,
|
||||
Expression *ethis, Expressions *arguments, Module* from);
|
||||
int overloadApply(Module* from, FuncDeclaration *fstart,
|
||||
int overloadApply(FuncDeclaration *fstart,
|
||||
int (*fp)(void *, FuncDeclaration *),
|
||||
void *param);
|
||||
|
||||
|
||||
18
dmd2/func.c
18
dmd2/func.c
@@ -2183,7 +2183,7 @@ int FuncDeclaration::overloadInsert(Dsymbol *s)
|
||||
* 1 done
|
||||
*/
|
||||
|
||||
int overloadApply(Module* from, FuncDeclaration *fstart,
|
||||
int overloadApply(FuncDeclaration *fstart,
|
||||
int (*fp)(void *, FuncDeclaration *),
|
||||
void *param)
|
||||
{
|
||||
@@ -2196,9 +2196,8 @@ int overloadApply(Module* from, FuncDeclaration *fstart,
|
||||
|
||||
if (fa)
|
||||
{
|
||||
if (fa->getModule() == from || fa->importprot != PROTprivate)
|
||||
if (overloadApply(from, fa->funcalias, fp, param))
|
||||
return 1;
|
||||
if (overloadApply(fa->funcalias, fp, param))
|
||||
return 1;
|
||||
next = fa->overnext;
|
||||
}
|
||||
else
|
||||
@@ -2213,11 +2212,6 @@ int overloadApply(Module* from, FuncDeclaration *fstart,
|
||||
break;
|
||||
if (next == fstart)
|
||||
break;
|
||||
#if IN_LLVM
|
||||
if (a->importprot == PROTprivate && a->getModule() != from)
|
||||
if (FuncDeclaration* fd = next->isFuncDeclaration())
|
||||
next = fd->overnext;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2257,7 +2251,7 @@ static int fpunique(void *param, FuncDeclaration *f)
|
||||
FuncDeclaration *FuncDeclaration::isUnique()
|
||||
{ FuncDeclaration *result = NULL;
|
||||
|
||||
overloadApply(getModule(), this, &fpunique, &result);
|
||||
overloadApply(this, &fpunique, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2303,7 +2297,7 @@ FuncDeclaration *FuncDeclaration::overloadExactMatch(Type *t, Module* from)
|
||||
Param1 p;
|
||||
p.t = t;
|
||||
p.f = NULL;
|
||||
overloadApply(from, this, &fp1, &p);
|
||||
overloadApply(this, &fp1, &p);
|
||||
return p.f;
|
||||
}
|
||||
|
||||
@@ -2406,7 +2400,7 @@ void overloadResolveX(Match *m, FuncDeclaration *fstart,
|
||||
p.ethis = ethis;
|
||||
p.property = 0;
|
||||
p.arguments = arguments;
|
||||
overloadApply(from, fstart, &fp2, &p);
|
||||
overloadApply(fstart, &fp2, &p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1342,7 +1342,7 @@ int fp3(void *param, FuncDeclaration *f)
|
||||
|
||||
static void inferApplyArgTypesX(Module* from, FuncDeclaration *fstart, Parameters *arguments)
|
||||
{
|
||||
overloadApply(from, fstart, &fp3, arguments);
|
||||
overloadApply(fstart, &fp3, arguments);
|
||||
}
|
||||
|
||||
/******************************
|
||||
|
||||
@@ -302,7 +302,7 @@ Expression *TraitsExp::semantic(Scope *sc)
|
||||
p.exps = exps;
|
||||
p.e1 = e;
|
||||
p.ident = ident;
|
||||
overloadApply(f->getModule(), f, fptraits, &p);
|
||||
overloadApply(f, fptraits, &p);
|
||||
|
||||
TupleExp *tup = new TupleExp(loc, exps);
|
||||
return tup->semantic(sc);
|
||||
|
||||
Reference in New Issue
Block a user