Opened 9 years ago

Closed 9 years ago

#9271 closed Bugs (fixed)

C4512 warnings with VS 2013 RTM

Reported by: sebi707@… Owned by: Antony Polukhin
Milestone: Boost 1.56.0 Component: lexical_cast
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Some conversions (e.g. std::string to float) result in a warning on the newest VS version. This are the warnings I'm getting while compiling a bigger project with the currect boost trunk version:

boost/lexical_cast.hpp(726): warning C4512: 'boost::detail::lcast_put_unsigned<Traits,utype,CharT>' : assignment operator could not be generated boost/lexical_cast.hpp(862): warning C4512: 'boost::detail::lcast_ret_unsigned<Traits,Type,CharT>' : assignment operator could not be generated boost/lexical_cast.hpp(1984): warning C4512: 'boost::detail::lexical_ostream_limited_src<char,std::char_traits<char>>' : assignment operator could not be generated

This classes (and possibly more) should have a deleted/private assignment operator or disable this warning altogether. Hopefully this can be fixed before the 1.55 release.

Change History (16)

comment:1 by Antony Polukhin, 9 years ago

(In [86374]) Supressing MSVC2013 warnings and ensuring that lexical cast io classes are not copied (refs #9271)

comment:2 by Antony Polukhin, 9 years ago

Thanks for reporting the issue! Could you please make some tests now? Are the warnings still there?

BTW, those classes do not exist in 1.55 (trunk has a big set of changes that were not merged to 1.55 release), so there is no need to worry about merging changes to 1.55

comment:3 by sebi707@…, 9 years ago

Thanks! This removed those warnings but I'm still getting warnings in another file. I'm not sure if this belongs to the lexical_cast component but if I convert the compoments of a boost::smatch to int using lexical_cast I get these warnings:

boost/detail/basic_pointerbuf.hpp(54): warning C4505: 'boost::detail::basic_pointerbuf<CharT,BufferType>::setbuf' : unreferenced local function has been removed
boost/detail/basic_pointerbuf.hpp(55): warning C4505: 'boost::detail::basic_pointerbuf<CharT,BufferType>::seekpos' : unreferenced local function has been removed
boost/detail/basic_pointerbuf.hpp(56): warning C4505: 'boost::detail::basic_pointerbuf<CharT,BufferType>::seekoff' : unreferenced local function has been removed

I guess these warnings are not really VS 2013 specific as the previous reported warnings also occur with VS 2010 if you compile with warning level 4.

comment:4 by Antony Polukhin, 9 years ago

(In [86377]) Suppress some of the Level 4 MSVC warnings in the basic_pointerbuf.hpp (refs #9271)

comment:5 by Antony Polukhin, 9 years ago

Could you please make some tests now? Are the warnings still there? Maybe there are some warnings in other libraries? (Unfortunately I do not have access to the MSVC2013 compiler)

comment:6 by raad@…, 9 years ago

In r86377, there is a #pragma warning(pop) without a matching #pragma warning(push) before the #pragma warning(disable: 4505). This leaves the warning disabled. Additionally, this leads to a new warning "C4193: #pragma warning(pop) : no matching '#pragma warning(push)'".

comment:7 by Antony Polukhin, 9 years ago

(In [86378]) Add missing #pragma wraning(push) (refs #9271)

comment:8 by Antony Polukhin, 9 years ago

Hope I forget nothing... Is it OK now?

comment:9 by raad@…, 9 years ago

Works for me now, thank you!

comment:10 by Antony Polukhin, 9 years ago

Thank you for reporting this bug!

comment:11 by Antony Polukhin, 9 years ago

Milestone: To Be DeterminedBoost 1.56.0
Resolution: fixed
Status: newclosed

comment:12 by sebi707@…, 9 years ago

Resolution: fixed
Status: closedreopened

Unfortunatly this didn't fix the warning for me. It seems that you cannot disable it by just wrapping the class with #pragma warning. The warning has to be disabled for the whole compilation unit. Here you can find some more informations: http://stackoverflow.com/questions/3051992/compiler-warning-at-c-template-base-class

I'm not sure what would be the best way to get rid of the warning. Declaring the functions as inline seems to work but it's not really a nice solution.

comment:13 by Antony Polukhin, 9 years ago

(In [86388]) Another attempt to suppress MSVC warnings (refs #9271)

comment:14 by Antony Polukhin, 9 years ago

GCC and Clang give no warning about adding an inline hint for virtual functions. Did it help to suppress MSVC warning?

comment:15 by sebi707@…, 9 years ago

Yes thanks! All the warnings are gone now.

comment:16 by Antony Polukhin, 9 years ago

Resolution: fixed
Status: reopenedclosed

(In [86654]) Merged a big bunch of internal code changes from trunk for lexical_cast: dropped support of antique compilers, code changed to produce a smaller binaries and simplify compiler's work, simplified and shortened the code, common with other libraries code moved to 'detail/basic_pointerbuf.hpp' (fixes #9046, fixes #9070, fixes #9271)

Note: See TracTickets for help on using tickets.