id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8743,warning in BOOST_BIMAP_STATIC_ERROR with clang trunk,Nathan Ridge,Matias Capeletto,"The following code: {{{ #include template struct S { BOOST_BIMAP_STATIC_ERROR(SOME_MESSAGE, (T)); }; }}} produces a warning with clang trunk: {{{ test.cpp:6:5: warning: class member cannot be redeclared [-Wgnu] BOOST_BIMAP_STATIC_ERROR(SOME_MESSAGE, (T)); ^ boost/bimap/detail/debug/static_error.hpp:30:30: note: expanded from macro 'BOOST_BIMAP_STATIC_ERROR' BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE), \ ^ boost/preprocessor/cat.hpp:22:32: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ :167:1: note: expanded from here BIMAP_STATIC_ERROR__SOME_MESSAGE ^ boost/mpl/assert.hpp:435:59: note: expanded from macro 'BOOST_MPL_ASSERT_MSG' BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \ ^ boost/mpl/assert.hpp:419:8: note: expanded from macro '\ BOOST_MPL_ASSERT_MSG_IMPL' struct msg; \ ^ test.cpp:6:5: note: previous declaration is here boost/bimap/detail/debug/static_error.hpp:28:16: note: expanded from macro 'BOOST_BIMAP_STATIC_ERROR' struct BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE) {}; \ ^ boost/preprocessor/cat.hpp:22:32: note: expanded from macro 'BOOST_PP_CAT' # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b) ^ boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I' # define BOOST_PP_CAT_I(a, b) a ## b ^ :166:1: note: expanded from here BIMAP_STATIC_ERROR__SOME_MESSAGE ^ }}} The reason is that the macro expands to the following: {{{ template struct S { struct BIMAP_STATIC_ERROR__SOME_MESSAGE {}; struct BIMAP_STATIC_ERROR__SOME_MESSAGE; // }; }}} The nested structure 'BIMAP_STATIC_ERROR_SOME_MESSAGE' is defined, and then redeclared. Such redeclaration is, apparently, not allowed. GCC accepts it as an extension, but the trunk version of clang warns about it. As a result, any code that uses Bimap is littered with warnings of this sort (since the library uses BOOST_BIMAP_STATIC_ERROR in multiple places). The fix is simple: modify BOOST_BIMAP_STATIC_ERROR to omit the definition, which is not necessary. The declaration emitted by BOOST_MPL_ASSERT_MSG is sufficient. Patch attached. ",Bugs,closed,To Be Determined,bimap,Boost 1.55.0,Problem,fixed,warning,braden@…