http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56373



--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-18 
12:07:49 UTC ---

The warning isn't issued when 0 converts to std::nullptr_t, only when it

converts to a pointer type.



struct shared_ptr

{

    shared_ptr(decltype(nullptr)) { }

    ~shared_ptr() { }

};



int main ()

{

  shared_ptr a = 0;

  shared_ptr b(0);

  shared_ptr c{0};

}





(In reply to comment #0)

> It's also a bit sad that only d is diagnosed as useless, although I do

> understand that the shared_ptr has a constructor and a destructor that use

> it.



It's necessary, because otherwise you get bogus warnings from ScopeGuard-style

RAII types.

Reply via email to