[pkg-boost-devel] Bug#778220: libboost-thread-dev: Build failure when compiling example program for boost::call_once with GCC 5

Gunnar Beutner gunnar at beutner.name
Thu Feb 12 12:44:53 UTC 2015


Package: libboost-thread-dev
Version: 1.55.0.2
Severity: normal

Dear Maintainer,

the following example program fails to compile with GCC 5:

#include <boost/thread/once.hpp> 

static boost::once_flag init_flag = BOOST_ONCE_INIT; 

static void once_init(void)
{

}

int main(int argc, char **argv)
{ 
	boost::call_once(&once_init, init_flag); 
} 

Trying to compile this program with GCC 5 (version from dpkg -l: 5-20150205-1) yields the following error message:

gunnar at debian:~$ g++ -o test test.cpp
In file included from test.cpp:1:0:
/usr/include/boost/thread/once.hpp: In instantiation of 'void boost::call_once(Function, boost::once_flag&) [with Function = void (*)()]':
test.cpp:12:43:   required from here
/usr/include/boost/thread/once.hpp:38:18: error: no matching function for call to 'call_once(boost::once_flag&, void (*&)())'
         call_once(flag,func);
                  ^
In file included from /usr/include/boost/thread/once.hpp:20:0,
                 from test.cpp:1:
/usr/include/boost/thread/pthread/once_atomic.hpp:121:15: note: candidate: template<class Function, class ... ArgTypes> void boost::call_once(boost::once_flag&, boost::detail::thread_move_t<T>, boost::detail::thread_move_t<Args>...)
   inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args)
               ^
/usr/include/boost/thread/pthread/once_atomic.hpp:121:15: note:   template argument deduction/substitution failed:
In file included from test.cpp:1:0:
/usr/include/boost/thread/once.hpp:38:18: note:   mismatched types 'boost::detail::thread_move_t<T>' and 'void (*)()'
         call_once(flag,func);
                  ^
/usr/include/boost/thread/once.hpp:35:13: note: candidate: template<class Function> void boost::call_once(Function, boost::once_flag&)
 inline void call_once(Function func,once_flag& flag)
             ^
/usr/include/boost/thread/once.hpp:35:13: note:   template argument deduction/substitution failed:
/usr/include/boost/thread/once.hpp:38:18: note:   cannot convert 'func' (type 'void (*)()') to type 'boost::once_flag&'
         call_once(flag,func);
                  ^

I can compile the program without any problems using GCC 4.7.2 and Clang 3.0.

-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=UTF-8 (charmap=locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libboost-thread-dev depends on:
ii  libboost-thread1.55-dev  1.55.0+dfsg-3

libboost-thread-dev recommends no packages.

libboost-thread-dev suggests no packages.

-- debconf information:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:en",
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory



More information about the pkg-boost-devel mailing list