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

fix conflicting "using std" declaration with "using boost::thread" #181

Closed
wants to merge 3 commits into from

Conversation

matlo607
Copy link
Contributor

@matlo607 matlo607 commented Feb 13, 2018

Summary

I experienced issues while building cucumber-cpp with the environment below.

Environment:

Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.3 LTS
Release:	16.04
Codename:	xenial

gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Boost 1.66.0

Errors:

/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:65:29: error: template argument 1 is invalid
     boost::scoped_ptr<thread> serverThread;
                             ^
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp: In member function ‘virtual void SocketServerTest::SetUp()’:
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:69:22: error: request for member ‘reset’ in ‘((SocketServerTest*)this)->SocketServerTest::serverThread’, which is of non-class type ‘int’
         serverThread.reset(new thread(&SocketServer::acceptOnce, server));
                      ^
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:69:32: error: expected type-specifier before ‘thread’
         serverThread.reset(new thread(&SocketServer::acceptOnce, server));
                                ^
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:68:23: error: unused variable ‘server’ [-Werror=unused-variable]
         SocketServer* server = createListeningServer();
                       ^
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp: In member function ‘virtual void SocketServerTest::TearDown()’:
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:74:25: error: base operand of ‘->’ is not a pointer
             serverThread->timed_join(THREAD_TEST_TIMEOUT);
                         ^
/home/matt/.conan/data/cucumber-cpp/0.4/murex/testing/build/232742180d6b48ffcaf9de5114f5a9b14f6df7e4/cucumber-cpp-0.4/tests/integration/WireServerTest.cpp:75:26: error: request for member ‘reset’ in ‘((SocketServerTest*)this)->SocketServerTest::serverThread’, which is of non-class type ‘int’
             serverThread.reset();
                          ^

using std; creates a conflict with using boost::thread; because std has also a class thread that must have been previously included by boost/thread.hpp

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • It is my own work, its copyright is implicitly assigned to the project and no substantial part of it has been copied from other sources (including Stack Overflow). In rare occasions this is acceptable, like in CMake modules where the original copyright information should be kept.
  • I'm using the same code standards as the existing code (indentation, spacing, variable naming, ...).
  • I've added tests for my code.
  • I have verified whether my change requires changes to the documentation
  • My change either requires no documentation change or I've updated the documentation accordingly.
  • My branch has been rebased to master, keeping only relevant commits.

@matlo607 matlo607 mentioned this pull request Feb 14, 2018
9 tasks
@matlo607
Copy link
Contributor Author

@paoloambrosio, @muggenhor or @konserw : could you please review the pull request ?
Please ignore the commit 08049bd, konserw told me it's wrong. I will wait for #184.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 63.329% when pulling f92bdac on matlo607:fix-using-namespace into 70fa12c on cucumber:master.

konserw added a commit to konserw/cucumber-cpp that referenced this pull request Mar 30, 2018
This is group-merge which consist actualy of following fixes:
* Remove -werror compiler flag to fix failing build with clang ([cucumber#184](cucumber#184) Kamil Strzempowicz)
* Add missing virtual destructor in base class SocketServer used by TCPSocketServer and UnixSocketServer ([cucumber#183](cucumber#183) Matthieu Longo)
* Fix breaking changes in API of boost-1.66.0 ([cucumber#180](cucumber#180)  Matthieu Longo)
* Fix conflicting "using std" declaration with "using boost::thread" ([cucumber#181](cucumber#181)  Matthieu Longo)
* Fixing Visual Studio 2013 error: no appropriate default constructor available ([cucumber#188](cucumber#188) Antoine Allard)
@konserw
Copy link
Contributor

konserw commented Mar 30, 2018

Merged as part of #189

@konserw konserw closed this Mar 30, 2018
@muggenhor muggenhor added this to the v0.5 milestone May 23, 2018
@matlo607 matlo607 deleted the fix-using-namespace branch July 16, 2018 10:31
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

Successfully merging this pull request may close these issues.

None yet

4 participants