Opened 10 years ago

Last modified 10 years ago

#8134 new Bugs

Compiler error using boost::foreach with boost::bimap

Reported by: john.x.foster@… Owned by: Matias Capeletto
Milestone: To Be Determined Component: bimap
Version: Boost 1.52.0 Severity: Showstopper
Keywords: Cc:

Description

boost_1_52_0\boost\multi_index\ordered_index.hpp(1399) : error C3083: 'BOOST_FOREACH': the symbol to the left of a '::' must be a type boost_1_52_0\boost\multi_index\ordered_index.hpp(1399) : error C2039: 'tag' : is not a member of 'boost' boost_1_52_0\boost\multi_index\ordered_index.hpp(1399) : error C2061: syntax error : identifier 'tag'

This occurs when using boost::bimap and boost::foreach. Seen first in 1.52, also in 1.53. OK in 1.49, with Visual tudio 2008 and 2010

Very simple VS2008 project included. Need to set environment variable BOOST_DIR to the boost directory, or change the project settings explicitly.

Attachments (1)

BugTest.7z (1.4 KB ) - added by john.x.foster@… 10 years ago.
Visual Studio 2008 project file and three very short source files.

Download all attachments as: .zip

Change History (4)

by john.x.foster@…, 10 years ago

Attachment: BugTest.7z added

Visual Studio 2008 project file and three very short source files.

comment:1 by Tom Stoffer <tom@…>, 10 years ago

Any progress on this?

comment:2 by Steven Watanabe, 10 years ago

don't #define foreach. This is a classic example of why macros are evil.

comment:3 by anonymous, 10 years ago

I agree, macros are evil, but...

... see the section in boost::foreach doco:

Making BOOST_FOREACH Prettier

There is no clash in my code - if boost documentation makes such recommendations then there should be no clash within the boost libraries, or there should be a disclaimer.

Note: See TracTickets for help on using tickets.