This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36760] Simple std::bind use causes warnings with -Wextra
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2008 17:04:45 -0000
- Subject: [Bug c++/36760] Simple std::bind use causes warnings with -Wextra
- References: <bug-36760-5473@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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