From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27144 invoked by alias); 1 Nov 2012 17:47:40 -0000 Received: (qmail 27040 invoked by uid 48); 1 Nov 2012 17:47:10 -0000 From: "mw_triad at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52718] -Wzero-as-null-pointer-constant: misleading location for 0 as default argument Date: Thu, 01 Nov 2012 17:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mw_triad at users dot sourceforge.net X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com X-Bugzilla-Target-Milestone: 4.7.1 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00050.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52718 --- Comment #12 from Matthew Woehlke 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=20 #include int main() { QLabel label; return 0; } $ g++ -std=3Dc++11 -Werror=3Dzero-as-null-pointer-constant zero-as-pointer.= cpp=20 zero-as-pointer.cpp: In function =E2=80=98int main()=E2=80=99: zero-as-pointer.cpp:5:10: error: zero as null pointer constant [-Werror=3Dzero-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=3D0, Qt::WindowFlags f=3D0); If I replace my declaration with: QLabel label(nullptr, Qt::WindowFlags(nullptr)); ...then I get no warning.