summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/overloadable.c
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2015-10-11 20:13:20 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2015-10-11 20:13:20 +0000
commit4546181e12c89c92e37f6da5cfb800b5b0fea755 (patch)
tree6f901c23b3940dc51b225f77650585c4bd7ecae3 /clang/test/Sema/overloadable.c
parentfcc34bdee0da68ffe520316fc8e369cce21f8466 (diff)
downloadbcm5719-llvm-4546181e12c89c92e37f6da5cfb800b5b0fea755.tar.gz
bcm5719-llvm-4546181e12c89c92e37f6da5cfb800b5b0fea755.zip
[Sema] Allow C conversions in C overload logic
C allows for some implicit conversions that C++ does not, e.g. void* -> char*. This patch teaches clang that these conversions are okay when dealing with overloads in C. Differential Revision: http://reviews.llvm.org/D13604 llvm-svn: 249995
Diffstat (limited to 'clang/test/Sema/overloadable.c')
-rw-r--r--clang/test/Sema/overloadable.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Sema/overloadable.c b/clang/test/Sema/overloadable.c
index bdd471477b4..3120649dbc0 100644
--- a/clang/test/Sema/overloadable.c
+++ b/clang/test/Sema/overloadable.c
@@ -85,3 +85,17 @@ void local() {
void after_local_1(int) __attribute__((overloadable)); // expected-error {{conflicting types}}
void after_local_2(int); // expected-error {{must have the 'overloadable' attribute}}
void after_local_3(int) __attribute__((overloadable));
+
+// Make sure we allow C-specific conversions in C.
+void conversions() {
+ void foo(char *c) __attribute__((overloadable));
+ void foo(char *c) __attribute__((overloadable, enable_if(c, "nope.jpg")));
+
+ void *ptr;
+ foo(ptr);
+
+ void multi_type(unsigned char *c) __attribute__((overloadable));
+ void multi_type(signed char *c) __attribute__((overloadable));
+ unsigned char *c;
+ multi_type(c);
+}
OpenPOWER on IntegriCloud