[Bug c++/82146] if () is always true error

2017-09-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #7 from Jonathan Wakely --- https://isocpp.org/wiki/faq/references#refs-not-null

[Bug c++/82146] if () is always true error

2017-09-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #6 from Jonathan Wakely --- (In reply to MaaSoftware from comment #5) > Ok. > > I am sorry, > return MyFunc(Num, *(CMaaString *)NULL, doc); // produces GPF in calling > method not here. So what? Dereferencing a null pointer has

[Bug c++/82146] if () is always true error

2017-09-08 Thread maasoftware at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #5 from MaaSoftware --- Ok. I am sorry, return MyFunc(Num, *(CMaaString *)NULL, doc); // produces GPF in calling method not here. I have think before what all references are object memory pointers inside compiller, just it is more

[Bug c++/82146] if () is always true error

2017-09-08 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #4 from Jonathan Wakely --- This has nothing to do with a new standard, *(CMaaString *)NULL is simply undefined behaviour, and that has alawys been true. You cannot dereference a null pointer. The bug is there, not inside MyFunc or

[Bug c++/82146] if () is always true error

2017-09-08 Thread maasoftware at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #3 from MaaSoftware --- Ok. So, it is need to review such code according new standard. PS: g++ 4.9.2 (Debian 8 Jessie) is compilling code above right. But it is not sufficient for 6.3.0 to write a function like void

[Bug c++/82146] if () is always true error

2017-09-08 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 Marc Glisse changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/82146] if () is always true error

2017-09-08 Thread maasoftware at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82146 --- Comment #1 from MaaSoftware --- it is a sample, int CMyClass::MyFunc can be as bool CMyClass::MyFunc