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: Jive Dadson <jdadson@…> 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:2 by Jive Dadson <jdadson@…>, 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 Michel Morin, 10 years ago

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 by Michel Morin, 10 years ago

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

comment:5 by Jive Dadson <jdadson@…>, 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 Michel Morin, 10 years ago

Resolution: invalid
Status: closedreopened

comment:7 by Jive Dadson <jdadson@…>, 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:9 by claudiordgz, 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 Marshall Clow, 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 James E. King, III, 5 years ago

Milestone: To Be DeterminedBoost 1.66.0
Owner: changed from Samuel Krempp to James E. King, III
Status: reopenednew

https://github.com/boostorg/format/pull/21 merged into develop leaving open until merged into master

comment:12 by James E. King, III, 5 years ago

Status: newassigned

comment:13 by James E. King, III, 5 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.