Opened 9 years ago
Closed 9 years ago
#8943 closed Bugs (fixed)
Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 on Windows
Reported by: | Owned by: | viboes | |
---|---|---|---|
Milestone: | Boost 1.55.0 | Component: | thread |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Environment:
- Windows 8 Pro x64 Russian.
- MS Visual Studio Ultimate 2012 Update 2.
- Intel C++ Composer XE 2013 (Intel C++ Compiler XE 13.0.0.089 for Windows).
Tried to compile this code:
#if defined(WIN32) #include <tchar.h> #endif #include <cstdlib> #include <iostream> #include <boost/thread/once.hpp> namespace { class foo { public: void operator()() const { std::cout << "foo" << std::endl; } }; // class foo } #if defined(WIN32) int _tmain(int /*argc*/, _TCHAR* /*argv*/[]) #else int main(int /*argc*/, char* /*argv*/[]) #endif { try { boost::once_flag once_flag = BOOST_ONCE_INIT; boost::call_once(once_flag, foo()); return EXIT_SUCCESS; } catch (...) { std::cerr << "Unknown exception" << std::endl; } return EXIT_FAILURE; }
Got compiler output with this error:
>main.cpp(31): error : more than one instance of overloaded function "boost::call_once" matches the argument list: > function template "void boost::call_once(boost::once_flag &, Function)" > function template "void boost::call_once(boost::once_flag &, Function &&)" > argument types are: (boost::once_flag, <unnamed>::foo) > boost::call_once(once_flag, foo()); > ^
There is no such error (tested) with:
- MS Visual C++ 2012 Update 3 (Visual Studio 2012 Update 3 on Windows 8 Pro x64 Rus),
- Visual C++ 2010 (Visual Studio 2010 on Windows 7 Pro SP1 Rus),
- Visual C++ 2008 (Visual Studio 2008 on Windows XP Pro SP3 Rus).
Attachments (1)
Change History (7)
by , 9 years ago
Attachment: | intel_thread_once.patch added |
---|
comment:1 by , 9 years ago
Component: | None → thread |
---|---|
Owner: | set to |
Status: | new → assigned |
follow-up: 4 comment:2 by , 9 years ago
Could you try this patch
Replace
#ifndef BOOST_MSVC
by
#if ! defined(BOOST_MSVC) && ! defined(BOOST_INTEL)
comment:3 by , 9 years ago
Summary: | Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 → Failed to compile code using boost::call_once with Intel C++ Composer XE 2013 on Windows |
---|
comment:4 by , 9 years ago
Replying to viboes:
Could you try this patch
Replace
#ifndef BOOST_MSVCby
#if ! defined(BOOST_MSVC) && ! defined(BOOST_INTEL)
This was the first solution I've done. But I think that this #if/#endif block isn't necessary at all (may produce errors for other compilers).
comment:5 by , 9 years ago
Milestone: | To Be Determined → Boost 1.55.0 |
---|
Committed revision [85539].
I would take some more time to refactor the call_once code windows implementation.
comment:6 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Proposed solution. Tested with all listed above compilers.