Opened 10 years ago

Closed 10 years ago

#7697 closed Bugs (fixed)

Boost.Test in C++11 w/ Clang fails with decltype usage

Reported by: Dean Michael Berris Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Error trace reproduced below:

clang-darwin.compile.c++ bin.v2/libs/test/build/clang-darwin-4.2.1/debug/unit_test_monitor.o
In file included from libs/test/src/unit_test_monitor.cpp:16:
In file included from ./boost/test/impl/unit_test_monitor.ipp:21:
In file included from ./boost/test/test_tools.hpp:373:
In file included from ./boost/test/tools/impl.hpp:25:
./boost/test/tools/assertion.hpp:158:1: error: expected ')'
BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER )
^
./boost/test/tools/assertion.hpp:90:13: note: expanded from macro 'BOOST_TEST_FOR_EACH_CONST_OP'
    action( >>, RSH, >> )                   \
            ^
./boost/test/tools/assertion.hpp:135:33: note: expanded from macro 'DEFINE_CONST_OPER'
    typedef DEDUCE_RESULT_TYPE( oper ) result_type; \
                                ^
./boost/test/tools/assertion.hpp:126:103: note: expanded from macro 'DEDUCE_RESULT_TYPE'
#   define DEDUCE_RESULT_TYPE( oper ) typename boost::remove_reference<decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() )>::type 
                                                                                                      ^
./boost/test/tools/assertion.hpp:158:31: note: to match this '('
BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER )
                              ^
./boost/test/tools/assertion.hpp:90:5: note: expanded from macro 'BOOST_TEST_FOR_EACH_CONST_OP'
    action( >>, RSH, >> )                   \
    ^
./boost/test/tools/assertion.hpp:135:13: note: expanded from macro 'DEFINE_CONST_OPER'
    typedef DEDUCE_RESULT_TYPE( oper ) result_type; \
            ^
./boost/test/tools/assertion.hpp:126:80: note: expanded from macro 'DEDUCE_RESULT_TYPE'
#   define DEDUCE_RESULT_TYPE( oper ) typename boost::remove_reference<decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() )>::type 
                                                                               ^
./boost/test/tools/assertion.hpp:158:1: error: expected ')'
BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER )
^
./boost/test/tools/assertion.hpp:92:5: note: expanded from macro 'BOOST_TEST_FOR_EACH_CONST_OP'
    BOOST_TEST_FOR_EACH_COMP_OP(action)     \
    ^
./boost/test/tools/assertion.hpp:69:13: note: expanded from macro 'BOOST_TEST_FOR_EACH_COMP_OP'
    action( > , GT, <= )                    \
            ^
./boost/test/tools/assertion.hpp:135:33: note: expanded from macro 'DEFINE_CONST_OPER'
    typedef DEDUCE_RESULT_TYPE( oper ) result_type; \
                                ^
./boost/test/tools/assertion.hpp:126:103: note: expanded from macro 'DEDUCE_RESULT_TYPE'
#   define DEDUCE_RESULT_TYPE( oper ) typename boost::remove_reference<decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() )>::type 
                                                                                                      ^
./boost/test/tools/assertion.hpp:158:31: note: to match this '('
BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER )
                              ^
./boost/test/tools/assertion.hpp:92:33: note: expanded from macro 'BOOST_TEST_FOR_EACH_CONST_OP'
    BOOST_TEST_FOR_EACH_COMP_OP(action)     \
                                ^
./boost/test/tools/assertion.hpp:69:5: note: expanded from macro 'BOOST_TEST_FOR_EACH_COMP_OP'
    action( > , GT, <= )                    \
    ^
./boost/test/tools/assertion.hpp:135:13: note: expanded from macro 'DEFINE_CONST_OPER'
    typedef DEDUCE_RESULT_TYPE( oper ) result_type; \
            ^
./boost/test/tools/assertion.hpp:126:80: note: expanded from macro 'DEDUCE_RESULT_TYPE'
#   define DEDUCE_RESULT_TYPE( oper ) typename boost::remove_reference<decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() )>::type 
                                                                               ^
2 errors generated.

    "clang++" -x c++ -Wall -Wself-assign -std=c++11 -stdlib=libc++ -O0 -g -O0 -fno-inline -Wall -pedantic -g -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_DYN_LINK=1 -I"." -c -o "bin.v2/libs/test/build/clang-darwin-4.2.1/debug/unit_test_monitor.o" "libs/test/src/unit_test_monitor.cpp"

...failed clang-darwin.compile.c++ bin.v2/libs/test/build/clang-darwin-4.2.1/debug/unit_test_monitor.o...

Clang version details:

Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

My user-config.jam:

using clang : : : <cxxflags>-Wall <cxxflags>-Wself-assign <cxxflags>-std=c++11 <cxxflags>-stdlib=libc++ <linkflags>-stdlib=libc++ ;

Change History (1)

comment:1 by Dean Michael Berris, 10 years ago

Resolution: fixed
Status: newclosed

Fixed as of r81362

Note: See TracTickets for help on using tickets.