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] strange warning message from -Waddress


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64877

--- Comment #2 from Tom Tromey <tromey at gcc dot gnu.org> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #1)

> Hard to say without a minimized testcase.

Yeah.

The original code is here:

https://dxr.mozilla.org/mozilla-central/source/gfx/gl/ScopedGLHelpers.h#35

My attempt to minimize it failed.
Here's what I tried.  I can't explain why this doesn't 
give any warnings as I would expect one on the second "assert",
based on what the manual says.

template<class Derived>
struct S
{
  void m() {
  }

  S()
  {
    if (&S<Derived>::Unwrap != &Derived::Unwrap)
      m();
    if (!(&Derived::UnwrapImpl))
      m();
  }

  void Unwrap() {
  }
};

struct T : public S<T>
{
  void UnwrapImpl() {
  }
};

T t;

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