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

--- Comment #12 from Matthew Woehlke <mw_triad at users dot sourceforge.net> 
2012-11-01 17:47:04 UTC ---
Requires qt-devel installed, but has the benefit of being the exact issue I'm
having in production (on the chance it's something screwy about Qt...):


$ cat zero-as-pointer.cpp 
#include <QtGui/QLabel>

int main()
{
  QLabel label;
  return 0;
}
$ g++ -std=c++11 -Werror=zero-as-null-pointer-constant zero-as-pointer.cpp 
zero-as-pointer.cpp: In function ‘int main()’:
zero-as-pointer.cpp:5:10: error: zero as null pointer constant
[-Werror=zero-as-null-pointer-constant]
cc1plus: some warnings being treated as errors
Exit 1
$ g++ --version
g++ (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

...maybe it got fixed in 4.7.3?


Note: the problem is this ctor:

explicit QLabel(QWidget *parent=0, Qt::WindowFlags f=0);

If I replace my declaration with:

QLabel label(nullptr, Qt::WindowFlags(nullptr));

...then I get no warning.

Reply via email to