This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77896] Object vtable lookups are not hoisted out of loops


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77896

--- Comment #5 from Ryan Johnson <scovich at gmail dot com> ---
In an ideal world, C++ would disallow such behavior by default, with a function
attribute of some kind that flags cases where a type change might occur (kind
of like how c++11 assumes `nothrow()` for destructors unless you specify
otherwise). Not only would it allow better optimizations, it would be safer,
because the compiler could then detect and forbid (or at least warn about)
problematic usage of such a class (like stack-allocating it, or calling a
type-change function when cast as the type that's about to change).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]