#13387 closed Bugs (fixed)
Test header fails to compile
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.67.0 | Component: | test |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | test, header, data | Cc: |
Description
The Boost header policy (http://www.boost.org/development/header.html) requires:
Make sure that a translation unit consisting of just the contents of the header file will compile successfully.
...but compiling:
#include <boost/test/data/test_case.hpp>
...gives errors...
In file included from geoff.cpp:1:0: /tmp/test-develop/include/boost/test/data/test_case.hpp:198:18: error: ‘list’ in namespace ‘std’ does not name a template type mutable std::list<test_unit*> m_test_cases; ^~~~ /tmp/test-develop/include/boost/test/data/test_case.hpp: In constructor ‘boost::unit_test::data::ds_detail::test_case_gen<TestCase, DataSet>::test_case_gen(boost::unit_test::data::ds_detail::test_case_gen<TestCase, DataSet>&&)’: /tmp/test-develop/include/boost/test/data/test_case.hpp:138:7: error: class ‘boost::unit_test::data::ds_detail::test_case_gen<TestCase, DataSet>’ does not have any field named ‘m_test_cases’ , m_test_cases( std::move(gen.m_test_cases) ) ^~~~~~~~~~~~ /tmp/test-develop/include/boost/test/data/test_case.hpp: In member function ‘virtual boost::unit_test::test_unit* boost::unit_test::data::ds_detail::test_case_gen<TestCase, DataSet>::next() const’: /tmp/test-develop/include/boost/test/data/test_case.hpp:153:13: error: ‘m_test_cases’ was not declared in this scope if( m_test_cases.empty() ) ^~~~~~~~~~~~ /tmp/test-develop/include/boost/test/data/test_case.hpp:156:26: error: ‘m_test_cases’ was not declared in this scope test_unit* res = m_test_cases.front(); ^~~~~~~~~~~~ /tmp/test-develop/include/boost/test/data/test_case.hpp: In member function ‘void boost::unit_test::data::ds_detail::test_case_gen<TestCase, DataSet>::operator()(Arg&& ...) const’: /tmp/test-develop/include/boost/test/data/test_case.hpp:178:9: error: ‘m_test_cases’ was not declared in this scope m_test_cases.push_back( ^~~~~~~~~~~~
This follows on from ticket:12228.
Change History (5)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Milestone: | To Be Determined → Boost 1.67.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:5 by , 5 years ago
Thanks very much - this now works for me.
It still fails under Clang but that seems to be because Clang defaults to -std=c++98
and that header requires ≥ C++11. When compiling that header as C++98 under GCC, the relevant error about the required standard is the first error but under Clang that message is a bit buried. If you could make it the first error under both, that might save some users a lot of time.
I should say: the above errors are from GCC 6.2.
Clang 5.0 gives: