Opened 15 years ago

Closed 13 years ago

Last modified 13 years ago

#1414 closed Feature Requests (fixed)

Warning suppression desirable for ios_state

Reported by: Paul A. Bristow Owned by: Daryle Walker
Milestone: Boost 1.36.0 Component: io
Version: Boost 1.34.1 Severity: Cosmetic
Keywords: warning ios_state Cc:

Description

It is most desirable for this warning to be suppressed to allow use at MSVC level 4 without several warnings - that I am confident are not helpful.

#ifndef BOOST_IO_IOS_STATE_HPP #define BOOST_IO_IOS_STATE_HPP

#if defined (_MSC_VER) # pragma warning (push) # pragma warning(disable : 4512) assignment operator could not be generated #endif

and at the end

#if defined (_MSC_VER) # pragma warning (pop) #endif

Attachments (1)

ios.diff (1.6 KB ) - added by Richard Webb <richard.webb@…> 15 years ago.

Download all attachments as: .zip

Change History (5)

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

Running the ios tests on VC9 with warning level 4 results in the warnings:

boost/io/ios_state.hpp(131) : warning C4512: 'boost::io::basic_ios_iostate_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(159) : warning C4512: 'boost::io::basic_ios_exception_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(183) : warning C4512: 'boost::io::basic_ios_tie_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(207) : warning C4512: 'boost::io::basic_ios_rdbuf_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(231) : warning C4512: 'boost::io::basic_ios_fill_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(256) : warning C4512: 'boost::io::basic_ios_locale_saver<Ch>' : assignment operator could not be generated
boost/io/ios_state.hpp(395) : warning C4512: 'boost::io::basic_ios_all_saver<Ch>' : assignment operator could not be generated

Some of the classes in ios_state.hpp already have private assignment operators, which avoids this warning. The attached patch adds them to the other classes, and silences the rest of the warnings.

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

Attachment: ios.diff added

comment:2 by Ryan Mulder <rjmyst3@…>, 14 years ago

This is also an issue for Visual Studio 2005

comment:3 by Vladimir Prus, 13 years ago

Resolution: fixed
Status: newclosed

(In [53425]) Add private assignment operators.

Patch from Richard Webb. This fixes #1414, where msvc complained that default assignment operator could not be generated. This can be fixed either by pragmas, or by declaring (but not defining), private assignment operator. The latter approach seems better, since it's likely to help on other compilers.

comment:4 by Daniel James, 13 years ago

(In [58747]) Merge warning fix from trunk. Fixes #1414.

Note: See TracTickets for help on using tickets.