rsmith added inline comments. ================ Comment at: lib/Sema/SemaExpr.cpp:10246-10253 @@ -10245,1 +10245,10 @@ + + if (RHS.get()->getType() == Context.OverloadTy) { + // As a set of extensions to C, we support overloading on functions. These + // functions need to be resolved here. + DeclAccessPair DAP; + if (FunctionDecl *FD = ResolveAddressOfOverloadedFunction( + RHS.get(), LHS.get()->getType(), /*Complain=*/false, DAP)) + RHS = FixOverloadedFunctionReference(RHS.get(), DAP, FD); + } } ---------------- Converting the RHS to the type of the LHS seems to only be appropriate for simple assignment operators, not for arbitrary binary operators.
================ Comment at: lib/Sema/SemaInit.cpp:4978-4990 @@ -4977,1 +4977,15 @@ + // As an extension, C can have overloaded functions. We need to add the + // address resolution step. + if (Initializer->getType() == Context.OverloadTy) { + bool MultipleCandidates; + DeclAccessPair DAP; + if (FunctionDecl *FD = S.ResolveAddressOfOverloadedFunction( + Initializer, DestType, false, DAP, &MultipleCandidates)) { + AddAddressOverloadResolutionStep(FD, DAP, MultipleCandidates); + } else { + SetFailed(InitializationSequence::FK_AddressOfOverloadFailed); + return; + } + } + ---------------- It would seem better to handle this in the assignment rules rather than duplicating it between here and the binary operator case. http://reviews.llvm.org/D13607 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits