[PATCH] D15590: [Bugfix] Disqualify unaddressable overload candidates when a function is directly called indirectly.

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 14:42:49 PST 2015


george.burgess.iv created this revision.
george.burgess.iv added a reviewer: rsmith.
george.burgess.iv added a subscriber: cfe-commits.

"directly called indirectly" wasn't a typo; I can't think of a better name for this pattern. :)

Currently, Sema treats `foo()` and `(&foo)()` both as direct calls of `foo`, for the purposes of overload resolution. CodeGen treats the latter as an indirect call. This allows one to write code that indirectly calls an unaddressable function, which can result in ICEs (yay `pass_object_size`).

It seems that some code relies on how Sema resolves `(&foo)()`, so I don't think we can simply ask `AddressOfFunctionResolver` to handle this for us.

http://reviews.llvm.org/D15590

Files:
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGenCXX/pass-object-size.cpp
  test/Sema/pass-object-size.c
  test/SemaCXX/pass-object-size.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15590.43065.patch
Type: text/x-patch
Size: 9516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151216/72352b36/attachment.bin>


More information about the cfe-commits mailing list