This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/64877] New: strange warning message from -Waddress


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]