Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with Boost. #62

Open
acdemiralp opened this issue Oct 12, 2017 · 3 comments
Open

Conflict with Boost. #62

acdemiralp opened this issue Oct 12, 2017 · 3 comments

Comments

@acdemiralp
Copy link

acdemiralp commented Oct 12, 2017

Hello, the following function (and any similar one which defines placeholders such as _1 ...) conflicts with boost::placeholders::_1 and produces warnings.

#define TROMPELOEIL_WITH_(capture, arg_s, ...)                                 \
  with(arg_s, [capture](auto const& trompeloeil_x) {                           \
    auto& _1 = ::trompeloeil::mkarg<1>(trompeloeil_x);                         \
    auto& _2 = ::trompeloeil::mkarg<2>(trompeloeil_x);                         \
    auto& _3 = ::trompeloeil::mkarg<3>(trompeloeil_x);                         \
    auto& _4 = ::trompeloeil::mkarg<4>(trompeloeil_x);                         \
    auto& _5 = ::trompeloeil::mkarg<5>(trompeloeil_x);                         \
    auto& _6 = ::trompeloeil::mkarg<6>(trompeloeil_x);                         \
    auto& _7 = ::trompeloeil::mkarg<7>(trompeloeil_x);                         \
    auto& _8 = ::trompeloeil::mkarg<8>(trompeloeil_x);                         \
    auto& _9 = ::trompeloeil::mkarg<9>(trompeloeil_x);                         \
    auto&_10 = ::trompeloeil::mkarg<10>(trompeloeil_x);                        \
    auto&_11 = ::trompeloeil::mkarg<11>(trompeloeil_x);                        \
    auto&_12 = ::trompeloeil::mkarg<12>(trompeloeil_x);                        \
    auto&_13 = ::trompeloeil::mkarg<13>(trompeloeil_x);                        \
    auto&_14 = ::trompeloeil::mkarg<14>(trompeloeil_x);                        \
    auto&_15 = ::trompeloeil::mkarg<15>(trompeloeil_x);                        \
    ::trompeloeil::ignore(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15); \
    return __VA_ARGS__;                                                        \
  })

The produced error is "Declaration of _... hides global declaration":

@rollbear
Copy link
Owner

Can you show a small stand alone test program that exposes this problem? On the face of it, I don't understand why there would be a conflict, and my small experiment compiled and worked.

Also, which compiler are you using? (MSVC, it looks like, but which version?)

Or is "blendet globale Deklaration" to say that it warns that there may be a misunderstanding about which _1 is meant, even though the C++ rules are clear? (I'm afraid my German was terrible 30 years ago, and has not improved with time.) If so, I fear there's not much I can do. It should also complain that boost _1 is in conflict with std::placeholders. Does it? What happens if you include both <boost/bind/placeholders.h> and , and use std::bind?

@tomvierjahn
Copy link

It should be MSVC from Visual Studio 2017 (15.3.409.57025)

English warning text: warning C4459: declaration of '_1' hides global declaration

@tomvierjahn
Copy link

We have resolved the issue on our side.

For the record:
We are using boost/signals2/connection.hpp and boost/signals2/signal.hpp. The former indirectly includes boost/bind.hpp. Then, boost/bind.hpp places the boost placeholders into global namespace.

Defining BOOST_BIND_NO_PLACEHOLDERS prior to including boost/signals2/connection.hpp and therefore prior to including boost/bind.hpp resolves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants