diff --git a/dmd2/cast.c b/dmd2/cast.c index 8b767442..1e0c6ddd 100644 --- a/dmd2/cast.c +++ b/dmd2/cast.c @@ -1263,6 +1263,14 @@ Expression *AddrExp::castTo(Scope *sc, Type *t) e = Expression::castTo(sc, t); } +#if IN_LLVM + else if (e1->op == TOKvar) + { + VarExp *ve = (VarExp*)e1->copy(); + ve->hasOverloads = 0; + e1 = ve; + } +#endif e->type = t; return e; } diff --git a/dmd2/expression.c b/dmd2/expression.c index 70531721..b7962efd 100644 --- a/dmd2/expression.c +++ b/dmd2/expression.c @@ -780,6 +780,23 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf, #endif // Give error for overloaded function addresses +#if IN_LLVM + if (arg->op == TOKaddress) + { AddrExp *ae = (AddrExp *)arg; + if (ae->e1->op == TOKvar) { + VarExp *ve = (VarExp*)ae->e1; + FuncDeclaration *fd = ve->var->isFuncDeclaration(); + if (fd && +#if DMDV2 + ve->hasOverloads && +#endif + !fd->isUnique()) + { + arg->error("function %s is overloaded", arg->toChars()); + } + } + } +#else if (arg->op == TOKsymoff) { SymOffExp *se = (SymOffExp *)arg; if ( @@ -789,6 +806,7 @@ Type *functionParameters(Loc loc, Scope *sc, TypeFunction *tf, !se->var->isFuncDeclaration()->isUnique()) arg->error("function %s is overloaded", arg->toChars()); } +#endif arg->rvalue(); } arg = arg->optimize(WANTvalue);