c++11 lambdas doesn't work with boost::concepts

231 Views Asked by At

The following code doesn't work with clang 3.3. but it does word with g++ 4.8.1. Boost version is 1.55.

#include <boost/concept_check.hpp>

template <typename X>
class  ConceptsBase {};

int main() {
    auto l = [](){};

    BOOST_CONCEPT_ASSERT((ConceptsBase<decltype(l)>));

    return 0;
}   

g++ -std=c++0x test.cpp -I /home/wygos/libs/boost_1_55_0/include/ # works fine!

clang++ -std=c++0x test.cpp -I /home/wygos/libs/boost_1_55_0/include/

gives:

test.cpp:9:5: error: non-type template argument refers to function 'failed' that does not have linkage
BOOST_CONCEPT_ASSERT((ConceptsBase<decltype(l)>));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wygos/libs/boost_1_55_0/include/boost/concept/assert.hpp:44:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wygos/libs/boost_1_55_0/include/boost/concept/detail/general.hpp:70:6: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
&::boost::concepts::requirement_<ModelFnPtr>::failed>    \
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wygos/libs/boost_1_55_0/include/boost/concept/detail/general.hpp:38:17: note: non-type template argument refers to function here
static void failed() { ((Model*)0)->~Model(); }

My lucky guess is that it might be connected to:

http://llvm.org/bugs/show_bug.cgi?id=17030

0

There are 0 best solutions below