The patch fixes the following related bugs:
1) Fix bug http://llvm.org/bugs/show_bug.cgi?id=7505 (overload resolution of &foo<int> when it identifies a single function) template<class T> void foo(T); bool b = &foo<int>; // now, ok. -- added a call to Sema::ResolveSingleFunctionTemplateSpecialization in Sema::ResolveAddressOfOverloadedFunction prior to any other deduction or resolution to check to see if the name identifies a single function (SemaOverload.cpp) -- modified Sema.h to add a 'Complain' flag to getMostSpecialized and ResolveSingleFunctionTemplateSpecialization so that we can percolate it through to these other functions that do Complain even if we don't intend to from ResolveAddressOfOverloadedFunction (required adding another call to ResolveOverload in SemaExpr.cpp with Complain set to true, since PerformImplicitConversion was calling it with 'false' yet the function was still complaining) (Sema.h, SemaTemplateDeduction.cpp) -- made some cosmetic changes (left the major refactoring for the next revision) to ResolveSingleFunctionTemplateSpecialization 2) Fix invalid conversion of an unresolved overloaded name into bool via '!' template<class T> void foo(T); bool b = !&foo; // this should be ambiguous -- Added a call to PerformContextuallyConvertToBool in CreateBuiltinUnaryOp to ensure that the OverloadTy does not leak through (semaExpr.cpp) 3) Fix for a better error message when we can't resolve a function name - When TryImplicitConversion fails in InitializationSequence Constructor before calling it a conversion failure, check to see if it could resolve the name, and if it can't then it is an overloadresolution failure (SemaInit.cpp) 4) Fix a bug that allowed invalid deduction during a c-style cast to a function reference - template<class T> void f(T); - (void)((void (&)(int,char))f); // this would compile and should error!! - (void)((void (*)(int,char))f); // error as expected - In 'TryStaticImplicitCast' before allowing a cstyle cast if a simple static cast failed, make sure we are not trying to cstyle cast a 'name' that could not be resolved using the information in the cast (i.e the destination signature) (SemaCXXCast.cpp) I verified the tests in /CXX and in /SemaCXX. As always, any feedback will be kindly appreciated :) thanks! Faisal Vali
patch-for-submission.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
