Modify

Opened 5 years ago

Last modified 3 years ago

#7477 reopened Bugs

boost:::format will not compile under VC++ without "Microsoft language extensions"

Reported by: Jive Dadson <jdadson@…> Owned by: Samuel Krempp
Milestone: To Be Determined 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.

Attachments (0)

Change History (9)

comment:2 Changed 5 years ago by Jive Dadson <jdadson@…>

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 Changed 5 years ago by Michel Morin

Resolution: invalid
Status: newclosed

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:4 Changed 5 years ago by Michel Morin

Ah, I meant "don't turn off Microsoft Language Extensions."

comment:5 Changed 5 years ago by Jive Dadson <jdadson@…>

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 Changed 5 years ago by Michel Morin

Resolution: invalid
Status: closedreopened

comment:7 Changed 5 years ago by Jive Dadson <jdadson@…>

@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:9 Changed 3 years ago by claudiordgz

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain Samuel Krempp.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.