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++/36760] Simple std::bind use causes warnings with -Wextra



------- Comment #10 from bangerth at dealii dot org  2008-07-09 17:04 -------
(In reply to comment #8)
> I was also trying to raise the issue of whether we think the warning is useful.
>  If it's not practical to avoid the warning in the library, then I wonder if
> it's practical to avoid it other generic-programming code.

I agree with this. As I mentioned in PR 30601, code like this

  template <typename T> class ArrayView {
    T& operator();
    T operator() const;
  };

is quite common and I don't see a need to make it more complicated than
necessary just for a warning. Yet, this class will trigger a warning if
instantiated as ArrayView<const double> because the return type of the second
operator() is now 'const double'. (Think of the class as providing a view
to a part of an array, so instantiating it with T=const double provides a
view that does not allow the elements to be modified.)

Personally, I find the fact that the compiler now warns about this very
annoying indeed.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


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


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