Opened 15 years ago

Closed 12 years ago

#1507 closed Bugs (fixed)

[variant] C4512 warnings from VC8.0

Reported by: Richard Webb <richard.webb@…> Owned by: ebf
Milestone: Boost 1.42.0 Component: variant
Version: Boost Development Trunk Severity: Cosmetic
Keywords: Cc:

Description

Variant produces a number of C4512 (assignment operator could not be generated) warnings when used in VC8 with warning level 4/code analysis enabled:

boost\variant\detail\apply_visitor_delayed.hpp(75) : warning C4512: 'boost::apply_visitor_delayed_t<Visitor>' : assignment operator could not be generated

boost\variant\variant.hpp(894) : warning C4512: 'boost::detail::variant::invoke_visitor<Visitor>' : assignment operator could not be generated

boost\variant\variant.hpp(1544) : warning C4512: 'boost::variant<T0_,T1,T2>::assigner' : assignment operator could not be generated

boost\variant\variant.hpp(650) : warning C4512: 'boost::detail::variant::backup_assigner<Variant,RhsT>' : assignment operator could not be generated

The attached patch silences the warnings that i'm seeing in my project.

Attachments (7)

variant.patch (1.3 KB ) - added by Richard Webb <richard.webb@…> 15 years ago.
variant2.patch (3.8 KB ) - added by Richard Webb <richard.webb@…> 15 years ago.
Silence 4512 warnings on VC9
visitation_impl.patch (772 bytes ) - added by Richard Webb <richard.webb@…> 14 years ago.
variant_300509.diff (1.3 KB ) - added by Richard Webb <richard.webb@…> 13 years ago.
variant101109.patch (3.3 KB ) - added by Richard Webb <richard.webb@…> 13 years ago.
variant.log (38.0 KB ) - added by Richard Webb <richard.webb@…> 13 years ago.
variantjam.diff (503 bytes ) - added by Richard Webb <richard.webb@…> 13 years ago.

Download all attachments as: .zip

Change History (17)

by Richard Webb <richard.webb@…>, 15 years ago

Attachment: variant.patch added

comment:1 by Richard Webb <richard.webb@…>, 15 years ago

Running the variant regression tests on VC9 with warning level 4 produces a number of warnings in addition to the above:

boost/variant/variant.hpp(532) : warning C4512: 'boost::detail::variant::direct_assigner<T>' : assignment operator could not be generated
boost/variant/variant.hpp(695) : warning C4512: 'boost::detail::variant::swap_with<Variant>' : assignment operator could not be generated
boost/variant/variant.hpp(751) : warning C4512: 'boost::detail::variant::comparer<Variant,Comp>' : assignment operator could not be generated

boost/variant/detail/variant_io.hpp(67) : warning C4512: 'boost::detail::variant::printer<OStream>' : assignment operator could not be generated

boost/variant/detail/apply_visitor_binary.hpp(66) : warning C4512: 'boost::detail::variant::apply_visitor_binary_invoke<Visitor,Value1>' : assignment operator could not be generated
boost/variant/detail/apply_visitor_binary.hpp(103) : warning C4512: 'boost::detail::variant::apply_visitor_binary_unwrap<Visitor,Visitable2>' : assignment operator could not be generated

Theres also an 'unreferenced parameter' warning:

boost/variant/variant.hpp(289) : warning C4100: 'operand' : unreferenced formal parameter

by Richard Webb <richard.webb@…>, 15 years ago

Attachment: variant2.patch added

Silence 4512 warnings on VC9

comment:2 by Richard Webb <richard.webb@…>, 14 years ago

When building in release mode, VC8/9 also produce some unreachable code warnings:

boost\variant\detail\visitation_impl.hpp(205) : warning C4702: unreachable code
boost\variant\detail\visitation_impl.hpp(180) : warning C4702: unreachable code
boost\variant\detail\visitation_impl.hpp(252) : warning C4702: unreachable code
boost\variant\detail\visitation_impl.hpp(280) : warning C4702: unreachable code

Attached is a patch for visitation_impl.hpp that uses a pragma to silence these.

by Richard Webb <richard.webb@…>, 14 years ago

Attachment: visitation_impl.patch added

by Richard Webb <richard.webb@…>, 13 years ago

Attachment: variant_300509.diff added

comment:3 by Richard Webb <richard.webb@…>, 13 years ago

Milestone: To Be DeterminedBoost 1.40.0

It would be nice to have at least the 'unreachable code' and 'unreferenced parameter' warnings fixed in 1.40 (the unreferenced parameter warning in particular causes a lot of noise of VC9/10).

The 'assignment operator could not be generated' warnings are less important (i've taken to switching it off globally anyway).

comment:4 by Richard Webb <richard.webb@…>, 13 years ago

A bunch of these have been fixed in [57501].

comment:5 by Richard Webb <richard.webb@…>, 13 years ago

Milestone: Boost 1.40.0Boost 1.42.0

Attached an updated patch based on running the current code in VC9.

by Richard Webb <richard.webb@…>, 13 years ago

Attachment: variant101109.patch added

comment:6 by Richard Webb <richard.webb@…>, 13 years ago

The regression tests also cause a bunch of "possible loss of data" warnings that i haven't had a chance to look at. Build log attached if anyone is interested.

by Richard Webb <richard.webb@…>, 13 years ago

Attachment: variant.log added

comment:7 by Richard Webb <richard.webb@…>, 13 years ago

There is also some

"warning C4535: calling _set_se_translator() requires /EHa "

warnings. As mentioned in the post @ http://old.nabble.com/Re%3A-Official-warnings-policy--p26288257.html, these can be fixed by setting the asynch-exceptions option in the variant jamfile.

by Richard Webb <richard.webb@…>, 13 years ago

Attachment: variantjam.diff added

in reply to:  7 comment:8 by anonymous, 13 years ago

Replying to Richard Webb <richard.webb@…>:

There is also some

"warning C4535: calling _set_se_translator() requires /EHa "

warnings. As mentioned in the post @ http://old.nabble.com/Re%3A-Official-warnings-policy--p26288257.html, these can be fixed by setting the asynch-exceptions option in the variant jamfile.

The right fix should be:

project

: requirements

<source>/boost/testminimal

;

comment:9 by anonymous, 13 years ago

Patches are now in Trunk, leaving open till they're in the release branch.

John.

comment:10 by Steven Watanabe, 12 years ago

Resolution: fixed
Status: newclosed

(In [62742]) Merge variant from the trunk. Fixes #1507

Note: See TracTickets for help on using tickets.