zygoloid wrote:

> Not sure if anyone has mentioned this elsewhere, but there's a significant 
> problem with the type of the returned function pointer: a normal function 
> pointer doesn't necessarily have the correct calling convention. In practice, 
> this is likely to cause problems on Windows.

The GCC extension [is also broken if a `this` adjustment is 
needed](https://godbolt.org/z/Ma8GGhK7n), even when the calling convention 
happens to line up. (And it's not possible to detect this problem locally -- it 
can happen even if [there is no multiple inheritance visible at the point where 
the extension is used](https://godbolt.org/z/GGExc1W8b).)

`declcall` doesn't have these problems and seems like a more robust way 
forward. (It does introduce *some* unnecessary overhead still, though, such as 
branching on whether the pointer-to-member is for a virtual function and 
emitting dead code for a virtual call; maybe we could consider some mechanism 
to declaratively state that a pointer-to-member type is known to not be a 
virtual pointer if we really care about that.)

https://github.com/llvm/llvm-project/pull/135649
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to