george.burgess.iv added inline comments.

================
Comment at: lib/Sema/SemaOverload.cpp:10419
@@ -10418,3 +10429,1 @@
-                                 ResultTy) ||
-          (!S.getLangOpts().CPlusPlus && TargetType->isVoidPointerType())) {
         Matches.push_back(std::make_pair(
----------------
rsmith wrote:
> Why is the `void*` check removed from this case? Note that clang and GCC 
> intentionally treat these two cases differently today:
> 
>     int f();
>     void *p = f; // ok (warning under -pedantic)
>     int *q = f; // warning: incompatible pointer types
> 
> (That is: the first is a silent-by-default extension and the second is a 
> warn-by-default extension.)
Because this is overload resolution logic, so we shouldn't care about what 
warnings we will emit :)

This is how we act prior to applying this patch:

```
void f(int) __attribute__((overloadable));
void f(double) __attribute__((overloadable, enable_if(0, "")));

void *fp = f; // OK. This is C and the target is void*.
void (*fp)(void) = f; // Error. This is C, but the target isn't void*.
```

I'm simply removing the "the target must be a `void*`" restriction; the user 
should still get warnings in the latter case (the tests changed in 
test/Sema/pass-object-size.c make sure of this).


http://reviews.llvm.org/D13704



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to