[Bug c++/71121] New: Spurious warning: "the address of [...] will never be NULL [-Waddress]"

ogoffart at kde dot org gcc-bugzilla@gcc.gnu.org
Sun May 15 09:28:00 GMT 2016


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

            Bug ID: 71121
           Summary: Spurious warning: "the address of [...] will never be
                    NULL [-Waddress]"
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ogoffart at kde dot org
  Target Milestone: ---

Regression in GCC 6:
The following code display a spurious warning about 
the addess of CC::mbr never being NULL despite it is not 
compared to null.

------------------------------

struct CC { void mbr(); };

constexpr auto getFunc() {
    return &CC::mbr;
}

constexpr bool xxx(void (CC::*_a)())
{
    constexpr auto f = getFunc();
    return (f == _a);
}

-------------------------------

shows a warning:

warning: the address of ‘void CC::mbr()’ will never be NULL [-Waddress]
     return (f == _a);
             ~~^~~~~

Live: http://melpon.org/wandbox/permlink/rPO9BmmGL8RxNsTI


More information about the Gcc-bugs mailing list