[PATCH] D32332: Add support for transparent overloadable functions in clang

George Burgess IV via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 11:46:12 PDT 2017


george.burgess.iv added a comment.

> I'd like to understand this use case a little bit better. If you don't perform the mangling, then choosing which overload gets called is already based on the source order, isn't it? See https://godbolt.org/g/8b10Ns

I think I might have miscommunicated: `transparently_overloadable` only enforces no mangling on one function out of the set of functions with the same name. So,

  void foo(int) __attribute__((transparently_overloadable));
  void foo(float) __attribute__((overloadable));
  
  void bar() {
    foo(1); // calls @foo
    foo(1f); // calls @_Z3foof
  }



> The logic as to why overloadable is required on every redeclaration makes sense, but also flies in the face of your rational for why you want a new spelling of the same attribute that doesn't need to be on every redeclaration. I worry about this difference being mildly confusing to user.

Yeah, good point. The more I think about that, the more I don't like the inconsistency; I'll drop that change.


https://reviews.llvm.org/D32332





More information about the cfe-commits mailing list