Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6374 closed Bugs (fixed)

operator << for exception doesn't work with 0/1 length tuples

Reported by: edA-qa mort-ora-y <edA-qa@…> Owned by: Emil Dotchevski
Milestone: To Be Determined Component: exception
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

The operator<< for boost exception allows attaching error_info structures. As a convenience it also takes a tuple form of those info structures. This tuple form does not work if the tuple is empty (0-length) or also if it is 1-length.

This is a compile-time matching issue.

The attached code shows the compile error (reduced to the essentials). It also includes the workaround which I am currently using (compile with WORKAROUND defined). Ideally the non-workaround version should work.

NOTE: This doesn't appear related to the macro itself. If you simple instantiate the exception and error_info tuple and use the operator directly the same compile-time error occurs. I've left the MACRO form to show the intent.

Attachments (1)

boost_exception_tuple.cc (1.6 KB) - added by edA-qa mort-ora-y <edA-qa@…> 6 years ago.
repoduction and workaround

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by edA-qa mort-ora-y <edA-qa@…>

Attachment: boost_exception_tuple.cc added

repoduction and workaround

comment:1 Changed 6 years ago by edA-qa mort-ora-y <edA-qa@…>

I'm using: gcc (GCC) 4.4.5 20101112 (Red Hat 4.4.5-2)

comment:2 Changed 6 years ago by Emil Dotchevski

Resolution: fixed
Status: newclosed

Fixed in trunk revision 76403, however I would suggest not using boost::tuple for this purpose, it might be better to instead unroll the ... in your macro into separate operator << calls.

comment:3 Changed 6 years ago by edA-qa mort-ora-y <edA-qa@…>

Why do you suggest that I don't use it for this purpose? Is it not efficient -- I'm expecting in optimized build the tuple stuff just disappears.

I'd be happy to just unroll the ... but I'm not aware of any language feature that would let me unroll it. Is it possible with BOOST's preprocessor library?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Emil Dotchevski.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.