Opened 10 years ago
Closed 5 years ago
#7477 closed Bugs (fixed)
boost:::format will not compile under VC++ WITH "Microsoft language extensions"
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | Boost 1.66.0 | Component: | format |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | format basic_streambuf throw() | Cc: |
Description
Boost::format will not compile under Microsoft VC++ unless Microsoft Language Extensions (/Za) are turned OFF. When MS Language Extensions are turned ON, the compiler complains because boost overrides some virtual functions in std:: classes with functions lacking a "throw()" specifier. One of the functions is the destructor ~basic_streambuf().
I do not know if this is a bug or a misunderstanding on my part. If it is a bug, I do not know whether it is on the MS or boost side. However, it should be a simple matter to decorate those functions with "throw()." That could save someone a lot of trouble.
Change History (13)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Eratum: I should have said, "Boost::format will not compile under Microsoft VC++ unless Microsoft Language Extensions (/Za) are turned ON." I cannot find an "edit" button on the ticket.
comment:3 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Don't use /Za.
The /Za option is buggy and you shouldn't use it. See the posts from Stephan T. Lavavej (Visual C++ libraries developer) such as this and this. Also, Boost's warning guidelines might be useful for you.
comment:5 by , 10 years ago
I would like for the decision to close this item to be reviewed. I spent hours figuring out what was wrong. Others will too. Or give up. What could it hurt to add "throw()" to some functions that cannot throw an exception?
comment:6 by , 10 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:7 by , 10 years ago
@James I tracked it down. The bug is in the VC++ header file The declaration for ~basic_streambuf() does not have a "throw()" exception-specifier. Section 27.6.3, C++11; Section 27.5.1 C++03. Nevertheless, boost could add it harmlessly. The destructor is on line 65 in alt_sstream_impl.hpp.
virtual ~basic_altstringbuf() throw() edit, j. dadson
{ dealloc(); }
comment:8 by , 10 years ago
I submitted a bug report to Microsoft. https://connect.microsoft.com/VisualStudio/feedback/details/766514/incorrect-exception-specifier-in-vc-header-file-causes-correct-user-code-not-to-compile#tabs - Jive
comment:9 by , 8 years ago
I spent hours as well, the error appeared in ASIO (No Boost) in my case in error.ipp
const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
and in error_code.ipp
const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
For the moment I had to add the throw, but I feel filthy.
I think this error should be fixed from MS end, just my two cents.
comment:10 by , 5 years ago
Summary: | boost:::format will not compile under VC++ without "Microsoft language extensions" → boost:::format will not compile under VC++ WITH "Microsoft language extensions" |
---|
comment:11 by , 5 years ago
Milestone: | To Be Determined → Boost 1.66.0 |
---|---|
Owner: | changed from | to
Status: | reopened → new |
https://github.com/boostorg/format/pull/21 merged into develop leaving open until merged into master
comment:12 by , 5 years ago
Status: | new → assigned |
---|
comment:13 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I asked about this on Stackoverflow. http://stackoverflow.com/questions/12764151/compiler-error-vc-2012-boostformat/12764654#12764654