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

            Bug ID: 70808
           Summary: Spurious -Wzero-as-null-pointer-constant for nullptr_t
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr
  Target Milestone: ---

The following program emits a warning when compiled with
-Wzero-as-null-pointer-constant:

int main()
{
    int* no_warn = {};
    // main.cpp:5:33: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
    decltype( nullptr ) warn = {};
}

Unless I'm mistaken, this is not intended as demonstrated by the innocuous
no_warn variable.

Happens on a variety of versions, e.g. 5.3.1 and 6, as well as multiple -std
settings, e.g. c++11 and c++1z.

Reply via email to