Amb
Amb

Reputation: 21

Can ubsan catch launder

I am considering the transmorgify example on cppref (https://en.cppreference.com/w/cpp/utility/launder). In the comments they mention that a second call to transmorgify would invoke undefined behaviour

// int m = base.transmogrify(); // undefined behavior

Does there exist a compiler (with a suitable sanitization option) that captures this ub? More generally in the range of examples given for the use case of std::launder does some ubsan tool expose the ub?

I have run both g++ and clang with sanitize flags and didn't get any runtime errors

Upvotes: 1

Views: 72

Answers (0)

Related Questions