[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-07-01 Thread ossman at cendio dot se via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 --- Comment #9 from Pierre Ossman --- Thank you! That worked nicely!

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 --- Comment #8 from Jonathan Wakely --- Even if you can't use C++17, it still works like this: if (not std::is_same::value) if (dynamic_cast(this) == nullptr)

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 --- Comment #7 from Jonathan Wakely --- if constexpr (not is_same_v) if (dynamic_cast(this) == nullptr) throw Exception("Bad callback");

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-27 Thread ossman at cendio dot se via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 --- Comment #6 from Pierre Ossman --- Is there a cleaner way to can work around this than duplicating the affected methods? I tried adding a #pragma, but that breaks older versions of gcc that don't have -Wnonnull-compare.

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 --- Comment #5 from Andrew Pinski --- Basically `dynamic_cast(this)` becomes just this if `T == Object` here and then we warn because this is compared with nullptr.

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 Andrew Pinski changed: What|Removed |Added Status|WAITING |NEW --- Comment #4 from Andrew Pinski

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 Andrew Pinski changed: What|Removed |Added Status|NEW |WAITING --- Comment #3 from Andrew Pins

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 Andrew Pinski changed: What|Removed |Added Status|WAITING |NEW --- Comment #2 from Andrew Pinski

[Bug c++/115664] -Wnonnull-compare breaks templated methods

2024-06-26 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 Marek Polacek changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed|