summaryrefslogtreecommitdiff
path: root/test/Sema/overloadable.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:09 +0000
commit2410013d9382b8129702fa3a3bf19a370ae7afc3 (patch)
treedf038b6418b19d03437950dcee799c1483c6246a /test/Sema/overloadable.c
parent0a5fb09b599c1bdea3cd11168bb8f4ff4040316e (diff)
Diffstat (limited to 'test/Sema/overloadable.c')
-rw-r--r--test/Sema/overloadable.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/overloadable.c b/test/Sema/overloadable.c
index f5e17d211910..49d8085651d4 100644
--- a/test/Sema/overloadable.c
+++ b/test/Sema/overloadable.c
@@ -151,3 +151,18 @@ void dropping_qualifiers_is_incompatible() {
foo(ccharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@148{{candidate function}} expected-note@149{{candidate function}}
foo(vcharbuf); // expected-error{{call to 'foo' is ambiguous}} expected-note@148{{candidate function}} expected-note@149{{candidate function}}
}
+
+// Bug: we used to treat `__typeof__(foo)` as though it was `__typeof__(&foo)`
+// if `foo` was overloaded with only one function that could have its address
+// taken.
+void typeof_function_is_not_a_pointer() {
+ void not_a_pointer(void *) __attribute__((overloadable));
+ void not_a_pointer(char *__attribute__((pass_object_size(1))))
+ __attribute__((overloadable));
+
+ __typeof__(not_a_pointer) *fn;
+
+ void take_fn(void (*)(void *));
+ // if take_fn is passed a void (**)(void *), we'll get a warning.
+ take_fn(fn);
+}