[PATCH] D40720: No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 13:37:16 PST 2017


vsk added a comment.

In https://reviews.llvm.org/D40720#958697, @sberg wrote:

> In https://reviews.llvm.org/D40720#958677, @vsk wrote:
>
> > Please add a test.
>
>
> Note that the bot upon the first closing of this review changed the shown diff from the combined cfe+compiler-rt diff to just the cfe part.  See https://reviews.llvm.org/rL320977 for the compiler-rt part, including tests in compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Function/function.cpp.


Ah sorry, I'd missed that. Still, it's always nice to have a test at the IR-gen level as well as the runtime test, since those can be a bit more stringent.

> Would it be possible to fix this by stripping the noexcept specifiers from both the function type used in the check and the one that is embedded in the prefix data? The downside is that we won't catch the case where the caller has a noexcept specifier and the callee doesn't, but that seems like an edge case to me, and we can think about fixing it in other ways later.

This sounds fine to me, and it avoids breaking the trapping mode.


Repository:
  rC Clang

https://reviews.llvm.org/D40720





More information about the cfe-commits mailing list