[Boost-bugs] [Boost C++ Libraries] #8943: Failed to compile code using boost::call_once with Intel C++ Composer XE 2013

Subject: [Boost-bugs] [Boost C++ Libraries] #8943: Failed to compile code using boost::call_once with Intel C++ Composer XE 2013
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-07-30 21:00:55


#8943: Failed to compile code using boost::call_once with Intel C++ Composer XE
2013
-----------------------+------------------------------
 Reporter: abrarov@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.54.0
 Severity: Problem | Keywords:
-----------------------+------------------------------
 Environment:
 1. Windows 8 Pro x64 Russian.
 2. MS Visual Studio Ultimate 2012 Update 2.
 3. Intel C++ Composer XE 2013 (Intel C++ Compiler XE 13.0.0.089 for
 Windows).

 Tried to compile this code:
 {{{#!cpp
 #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).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8943>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC