Boost logo

Boost Users :

From: Josef Grahn (josef.grahn_at_[hidden])
Date: 2007-10-19 13:32:16


Hi,

Visual Studio 2005 gives me warning C4180 ("qualifier applied to
function type has no meaning; ignored") when binding member functions
that has a templatized type as return type with boost::bind, but I can't
see any reason why it should. The following example reproduces the warning:

#include <boost/bind.hpp>

template <typename T> struct Foo {};

struct Bar {
    Foo<void> f() { return Foo<void>(); }
    int g() { return 0; }
};

Foo<void> f() { return Foo<void>(); }

int main(int argc, const char **argv) {
    Bar b;
    boost::bind(&Bar::f, &b); // Warning C4180 (see below)
    boost::bind(&Bar::g, &b); // No warning
    boost::bind(f); // No warning
    return 0;
}

So far as I have tested, the program appears to function properly. The
full warning is as follows (paths shortened):

C:\...\boost/bind.hpp(1575) : warning C4180: qualifier applied to
function type has no meaning; ignored
        C:\...\boost/bind.hpp(1609) : see reference to class template
instantiation 'boost::_bi::add_cref<Pm,I>' being compiled
        with
        [
            Pm=Foo<void> (__thiscall Bar::* )(void),
            I=1
        ]
        ..\..\..\src\main.cpp(14) : see reference to class template
instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled
        with
        [
            Pm=Foo<void> (__thiscall Bar::* )(void),
            A1=Bar *
        ]

GCC 4.1.2 on Linux compiles the code without warnings. Any insights are
greatly appreciated!

Best regards,

Josef Grahn


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net