Opened 14 years ago

Closed 13 years ago

#2015 closed Bugs (fixed)

boost::format::operator% does not work with anonymous types inside a namespace

Reported by: Geoff Barrett <gbarrett@…> Owned by: Samuel Krempp
Milestone: To Be Determined Component: format
Version: Boost 1.34.0 Severity: Problem
Keywords: Cc:

Description

Using g++ version 3.3.3. Actual sources are from 1.33.1 but these don't seem to be different from what is currently in the repository. I get the following error message. If I remove the template specification from the calls in the body of several functions, the errors go away. In the attached file, the function foo2 suffers the same problem as operator% but foo1 does not.

With g++ 4.2.1, this change does not work either.

.../boost/format/format_class.hpp: In

member function `boost::basic_format<Ch, Tr, Alloc>& boost::basic_format<Ch, Tr, Alloc>::operator%(const T&) [with T = bcu::<anonymous enum>, Ch = char, Tr = std::char_traits<char>, Alloc = std::allocator<char>]':

format_bug.cc:52: instantiated from here .../boost/format/format_class.hpp:64: error: template-argument

`const bcu::<anonymous enum>&' uses anonymous type

.../boost/format/format_class.hpp:64: error: no

matching function for call to `feed(boost::basic_format<char, std::char_traits<char>, std::allocator<char> >&, const bcu::<anonymous enum>&)'

Attachments (2)

format_bug.cc (1.1 KB ) - added by Geoff Barrett <gbarrett@…> 14 years ago.
program that reproduces the problem
format.patch (3.2 KB ) - added by Steven Watanabe 13 years ago.
Fix for the problem

Download all attachments as: .zip

Change History (3)

by Geoff Barrett <gbarrett@…>, 14 years ago

Attachment: format_bug.cc added

program that reproduces the problem

by Steven Watanabe, 13 years ago

Attachment: format.patch added

Fix for the problem

comment:1 by anonymous, 13 years ago

Resolution: fixed
Status: newclosed

fixed by applying suggested patch (in revision 57695) Thanks to Steven Watanabe for the fix.

Note: See TracTickets for help on using tickets.