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 middle-end/16502] inappropriate -Wunreachable-code warning from generic code


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-12 22:02 -------
Fixed:
pr16502.cc: In function `void foo(T*) [with T = int]':
pr16502.cc:17:   instantiated from here
pr16502.cc:9: warning: will never be executed
/export/gates/pinskia/openbsd/bin/../lib/gcc/i686-unknown-openbsd3.1/3.5.0/../../../../include/c+
+/3.5.0/new: In function `void* operator new(size_t, void*)':
/export/gates/pinskia/openbsd/bin/../lib/gcc/i686-unknown-openbsd3.1/3.5.0/../../../../include/c+
+/3.5.0/new:92: warning: will never be executed

now what is being warned abut is the throw() of the function is not ever going to happen which is true 
and the catch cannot happen which is also true.

And if we look at the default placement defintion:
inline void* operator new(std::size_t, void* __p) throw() { return __p; }
this is right.  Now -Wunreachable-code is correct, I would not use it all anyways because of all these 
postives.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |middle-end
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16502


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