[PATCH] D13704: [Fix] Allow implicit conversions of the address of overloadable functions in C + docs update

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 16 14:29:14 PST 2016


george.burgess.iv updated this revision to Diff 48111.
george.burgess.iv added a comment.

- Reworded docs update
- Added support for `reinterpret_cast`s of overloaded functions in both C and C++
- Added general facility in `Sema` to query if an overloaded expression can resolve to being not-overloaded on its own (e.g. if it's an address-of function expression *and* it's the only addressable overload with the given name)

I made it generally available because there's a problem that this patch doesn't fix (will submit as separate phabricator review), and I suspect that this new functionality will be useful for solving that problem. Namely, the problem is template argument deduction (joy):

  template <typename Fn> int foo(Fn);
  
  void bar();
  void bar(int) __attribute__((enable_if(0, "")));
  int a = foo(bar); // cannot deduce `Fn` because `bar` is an overload.


http://reviews.llvm.org/D13704

Files:
  include/clang/Basic/AttrDocs.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGen/overloadable.c
  test/Sema/overloadable.c
  test/Sema/pass-object-size.c
  test/SemaCXX/enable_if.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13704.48111.patch
Type: text/x-patch
Size: 23632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160216/6aa4af0f/attachment-0001.bin>


More information about the cfe-commits mailing list