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

maasoftware at yandex dot ru gcc-bugzilla@gcc.gnu.org
Fri Sep 8 10:56:00 GMT 2017


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

--- Comment #3 from MaaSoftware <maasoftware at yandex dot ru> ---
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 NotWorkedBugAround(CMaaString *a, CMaaString b)
{
    if (a)
    {
        *a = b;
    }
}
and call 
    NotWorkedBugAround(&Path, FileName);
instead of
    if   (&Path)
    {
        Path = FileName;
    }
to avoid wrong NULL references handling. (Tested with -O2 and -O3).


More information about the Gcc-bugs mailing list