Re: [Boost-bugs] [Boost C++ Libraries] #1097: keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1097: keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-10-17 17:05:50


#1097: keyword.hpp generates many warnings C4180: qualifier applied to function
type has no meaning; ignored
-------------------------------+--------------------------------------------
  Reporter: pbristow | Owner: danielw
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: parameter
   Version: release 1.34.0 | Severity: Problem
Resolution: | Keywords: parameter keyword c4180
-------------------------------+--------------------------------------------
Comment (by anonymous):

 I get a similar problem, this is the simplest code to reproduce it (in
 msvc-8.0)
 {{{
 #include <boost/bind.hpp>

 template<typename T>
 struct Foo
 {
    Foo(T const& t_) : t(t_) {}
    T t;
 };

 typedef Foo<int> BarT;
 //typedef int Bar;

 class Moo
 {
 public:
    BarT GetBar ()
    {
       return BarT(42);
    }
 };

 int main()
 {
    Moo moo;
    boost::bind(&Moo::GetBar, moo);
 }
 }}}

 and the warning:

 {{{
 1>boost\boost.1.34.1\boost\boost\bind.hpp(1575) : warning C4180: qualifier
 applied to function type has no meaning; ignored
 1> boost\boost.1.34.1\boost\boost\bind.hpp(1609) : see reference to
 class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled
 1> with
 1> [
 1> Pm=Foo<int> (__thiscall Moo::* )(void),
 1> I=1
 1> ]
 1> test1\test1.cpp(25) : see reference to class template
 instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled
 1> with
 1> [
 1> Pm=BarT (__thiscall Moo::* )(void),
 1> A1=Moo
 1> ]
 }}}

 The compiler seems to be choosing the member specialisation of add_cref:

 {{{
 template< class M, class T > struct add_cref< M T::*, 1 >
 {
     typedef M const & type; // line 1575
 };
 }}}

 rather than the member function specialisation:

 {{{
 template< class R, class T > struct add_cref< R (T::*) (), 1 >
 {
     typedef void type; // line 1580
 };
 }}}

 If you change the typedef of Bar to the int, all is well.

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1097#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC