[Sema] Relax overloading restrictions in C.
This patch allows us to perform incompatible pointer conversions when resolving overloads in C. So, the following code will no longer fail to compile (though it will still emit warnings, assuming the user hasn't opted out of them): ``` void foo(char *) __attribute__((overloadable)); void foo(int) __attribute__((overloadable)); void callFoo() { unsigned char bar[128]; foo(bar); // selects the char* overload. } ``` These conversions are ranked below all others, so: A. Any other viable conversion will win out B. If we had another incompatible pointer conversion in the example above (e.g. `void foo(int *)`), we would complain about an ambiguity. Differential Revision: https://reviews.llvm.org/D24113 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280553 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/AttrDocs.td 5 additions, 0 deletionsinclude/clang/Basic/AttrDocs.td
- include/clang/Sema/Overload.h 5 additions, 1 deletioninclude/clang/Sema/Overload.h
- lib/Sema/SemaExprCXX.cpp 1 addition, 0 deletionslib/Sema/SemaExprCXX.cpp
- lib/Sema/SemaOverload.cpp 38 additions, 15 deletionslib/Sema/SemaOverload.cpp
- test/CodeGen/builtins-systemz-zvector-error.c 11 additions, 22 deletionstest/CodeGen/builtins-systemz-zvector-error.c
- test/CodeGen/overloadable.c 15 additions, 0 deletionstest/CodeGen/overloadable.c
- test/Sema/overloadable.c 30 additions, 1 deletiontest/Sema/overloadable.c
- test/Sema/pass-object-size.c 1 addition, 1 deletiontest/Sema/pass-object-size.c
- test/SemaOpenCL/event_t_overload.cl 3 additions, 3 deletionstest/SemaOpenCL/event_t_overload.cl
Loading
Please register or sign in to comment