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

Sergei Trofimovich <slyfox at inbox dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slyfox at inbox dot ru

--- Comment #3 from Sergei Trofimovich <slyfox at inbox dot ru> ---
Don't know if it's the same problem, but firefox-78 also fails to build with
'-Werror=nonnull' seeming false positives.

cvise produced the following example:

$ cat bug.cpp
    struct a {
      void b();
    };
    struct c {
      template <typename d> class e {
      public:
        int operator*();
        void operator++() { d()->b(); }
        bool operator!=(e);
      };
      e<a *> begin();
      e<a *> end();
    };
    class f {
      c g;
      void h();
    };
    void f::h() {
      for (auto i : g)
        ;
    }

$ x86_64-pc-linux-gnu-g++-10.1.0 -o bug.o -c bug.cpp -std=c++17 -Werror=nonnull
-Wno-unused-variable -O0 -fsyntax-only

$ /home/slyfox/dev/git/gcc-native-quick/gcc/xg++ -B
/home/slyfox/dev/git/gcc-native-quick/gcc -o bug.o -c bug.cpp -std=c++17
-Werror=nonnull -Wno-unused-variable -O0 -fsyntax-only
bug.cpp: In instantiation of 'void c::e<d>::operator++() [with d = a*]':
bug.cpp:19:17:   required from here
bug.cpp:8:31: error: 'this' pointer null [-Werror=nonnull]
    8 |     void operator++() { d()->b(); }
      |                         ~~~~~~^~
bug.cpp:2:8: note: in a call to non-static member function 'void a::b()'
    2 |   void b();
      |        ^
cc1plus: some warnings being treated as errors

Reply via email to