Opened 13 years ago

Closed 13 years ago

#3485 closed Bugs (fixed)

Boost 1.40 Example.cpp program produces pages of MSVC level 1 warning 4180

Reported by: Paul A. Bristow Owned by: Dave Abrahams
Milestone: Boost 1.42.0 Component: Getting Started Guide
Version: Boost Release Branch Severity: Cosmetic
Keywords: warning lambda Cc:

Description

Compiling... Getting started example.cpp example.cpp I:\boost_trunk\boost/lambda/detail/lambda_functors.hpp(140) : warning C4180: qualifier applied to function type has no meaning; ignored

I:\boost_trunk\boost/lambda/detail/lambda_functor_base.hpp(172) : see reference to class template instantiation 'boost::lambda::lambda_functor<T>' being compiled with [

T=boost::lambda::identity<const int>

]

...

with [

T=boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::multiply_action>,boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,const int,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>>

This is harmless but doesn't get newbies off to an encouraging start!

I would be *much* nicer to have this warning (MSVC level 1) removed or quieted in lambda.

But it is not obvious to me how to do this - adding disable for the existing warning supression does not quiet the warning.

#pragma warning (disable : 4180) as the first line does work.

Change History (8)

comment:1 by Paul A. Bristow, 13 years ago

Has been fixed already. Sorry for noise - I was muddled the include order - again :-(

comment:2 by Steven Watanabe, 13 years ago

Resolution: invalid
Status: newclosed

in reply to:  1 comment:3 by Paul A. Bristow, 13 years ago

Milestone: Boost 1.41.0Boost 1.42.0
Resolution: invalid
Status: closedreopened
Version: Boost 1.40.0Boost Release Branch

I've noticed in passing that at 1_41_1_beta that example.cpp is still producing two pages of warnings for this example.

I think that in lambda_functors.hpp, it needs adding a

#pragma warning(disable:4180) qualifier applied to function type has no meaning;

thus:

#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(push) #pragma warning(disable:4512) assignment operator could not be generated #pragma warning(disable:4180) qualifier applied to function type has no meaning; ignored #endif

Sorry for my continued muddle :-(

(Note: Version box does not yet include 1.41)

comment:4 by Steven Watanabe, 13 years ago

The example compiles without warnings for me in both the trunk and release branches with msvc 8.0 and 9.0 /W4. I haven't checked the beta yet, although I would expect it to be the same as the release branch.

comment:5 by Steven Watanabe, 13 years ago

The beta appears to be okay too, even using the IDE instead of bjam to build.

in reply to:  5 comment:6 by Paul A. Bristow, 13 years ago

Replying to steven_watanabe:

The beta appears to be okay too, even using the IDE instead of bjam to build.

This is bizarre. I have also reported some similar 4180 warnings in boost::math which John could not reproduce despite having a test .cpp program from me.

But I have just tried again enabling MS extensions = no and the warnings disappear.

So disabling MS extensions = Yes (/Za) provokes the warnings!

But John has removing the complained-about const s (from trunk) and my test now compiles free of warnings from boost::math - but with some still from Fusion.

I am unclear if the addition of const to a function is actually prohibited by the C++ Standard, and indeed why const has been added by Joel and John - who are not novices ;-)

So I feel that removing the consts is preferred but disabling the warning would be second best.

comment:7 by Steven Watanabe, 13 years ago

Okay. I've duplicated the problem.

comment:8 by Steven Watanabe, 13 years ago

Resolution: fixed
Status: reopenedclosed

(In [57479]) Deal with warnings with /Za. Fixes #3485

Note: See TracTickets for help on using tickets.