public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64877] New: strange warning message from -Waddress
Date: Fri, 30 Jan 2015 16:56:00 -0000 [thread overview]
Message-ID: <bug-64877-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64877
Bug ID: 64877
Summary: strange warning message from -Waddress
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tromey at gcc dot gnu.org
I found a spot in firefox that tries to prevent hiding
using:
explicit ScopedGLWrapper(GLContext* gl)
: mIsUnwrapped(false)
, mGL(gl)
{
MOZ_ASSERT(&ScopedGLWrapper<Derived>::Unwrap == &Derived::Unwrap);
[...]
void Unwrap() {
...
}
gcc 5 warns about this assert:
/home/tromey/firefox-git/gecko-dev/gfx/gl/ScopedGLHelpers.h:35:54: error: the
address of ‘void mozilla::gl::ScopedGLWrapper<Derived>::Unwrap() [with Derived
= mozilla::gl::ScopedGLState]’ will never be NULL [-Werror=address]
MOZ_ASSERT(&ScopedGLWrapper<Derived>::Unwrap == &Derived::Unwrap);
^
The message here is strange. Whether or not the address can be NULL
is not an issue. I don't see why -Waddress ought to warn here at all.
>From gcc-bugs-return-475537-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 30 16:58:42 2015
Return-Path: <gcc-bugs-return-475537-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29662 invoked by alias); 30 Jan 2015 16:58:41 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29593 invoked by uid 48); 30 Jan 2015 16:58:35 -0000
From: "tromey at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/20710] g++ should warn when hiding non-virtual method in base class
Date: Fri, 30 Jan 2015 16:58: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-Version: 3.4.3
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: tromey at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-20710-4-e15QIsjYqH@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-20710-4@http.gcc.gnu.org/bugzilla/>
References: <bug-20710-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg03531.txt.bz2
Content-length: 833
https://gcc.gnu.org/bugzilla/show_bug.cgi?id 710
Tom Tromey <tromey at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at gcc dot gnu.org
--- Comment #8 from Tom Tromey <tromey at gcc dot gnu.org> ---
It would be nice to have a way to prevent hiding.
See the partial example in bug 64877. Here, gcc 5
warns about the construct used to prevent hiding.
However, "final" will not work as the function in question
is non-virtual.
The class in question is a base class, so it seems rather
strange to make the function "virtual final". And, while
not an issue in this particular case, that would in some
cases introduce a vtable where none was previously needed.
next reply other threads:[~2015-01-30 16:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 16:56 tromey at gcc dot gnu.org [this message]
2015-01-30 18:16 ` [Bug c++/64877] " manu at gcc dot gnu.org
2015-01-30 18:38 ` tromey at gcc dot gnu.org
2015-01-31 16:05 ` manu at gcc dot gnu.org
2015-01-31 17:38 ` [Bug c++/64877] [5 Regression] " paolo.carlini at oracle dot com
2015-02-03 17:22 ` paolo at gcc dot gnu.org
2015-02-03 17:23 ` paolo.carlini at oracle dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-64877-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).