Hi,
I’m trying to implement an overloading behavior to some of our builtin functions, and came across the following comment in SemaExpr.cpp
// Check for overloaded calls. This can happen even in C due to extensions.
If (Fn->getType() == Context.OverloadTy) { ….
I was wondering which C extensions is this referring to?
Thanks
Ali
http://clang.llvm.org/docs/LanguageExtensions.html#function-overloading-in-c
#include <stdio.h>
void __attribute__((overloadable)) onearg(int i) { printf("Arg is int: %d\n", i); }
void __attribute__((overloadable)) onearg(char *s) { printf("Arg is string: %s\n", s); }
int main() {
onearg(1);
onearg("String");
return 0;
}
$ clang test.c && ./a.out
Arg is int: 1
Arg is string: String