Attempt to fix build of unit tests on GCC 4.8

The tests were building just fine on Clang and GCC 7, but not on GCC 4.8
that Travis CI uses. That points towards a compiler bug. As a workaround,
simply initialize the widgets in a more straightforward way.
This commit is contained in:
Jyrki Vesterinen 2017-08-25 21:31:01 +03:00 committed by Charles Dang
parent eff2fc60e6
commit cd68243e64
2 changed files with 8 additions and 11 deletions

View file

@ -121,11 +121,9 @@ static void add_widget(gui2::grid& grid
, 0);
}
template<class T, typename... T2>
static void test_control(T2&&... args)
template<class T>
static void test_control(T&& control)
{
T control(std::forward<T2>(args)...);
{
gui2::iteration::iterator< gui2::iteration::policy::order::top_down<
true
@ -171,14 +169,14 @@ static void test_control(T2&&... args)
static void test_control()
{
/* Could add more widgets to the list. */
test_control<gui2::label>(gui2::implementation::builder_label(config()));
test_control(gui2::label(gui2::implementation::builder_label(config())));
}
static void test_grid()
{
/* An empty grid behaves the same as a control so test here. */
test_control<gui2::grid>();
test_control(gui2::grid());
/* Test the child part here. */
gui2::grid grid(2 ,2);

View file

@ -41,12 +41,11 @@ static void add_widget(gui2::grid& grid
, 0);
}
template<class T, typename... T2>
static void test_control(T2&&... args)
template<class T>
static void test_control(T&& control)
{
//std::cerr << __func__ << ": " << typeid(T).name() << ".\n";
T control(std::forward<T2>(args)...);
const std::unique_ptr<gui2::iteration::walker_base> visitor(control.create_walker());
BOOST_REQUIRE_NE(visitor.get(), static_cast<void*>(nullptr));
@ -83,13 +82,13 @@ static void test_control(T2&&... args)
static void test_control()
{
/* Could add more widgets to the list. */
test_control<gui2::label>(gui2::implementation::builder_label(config()));
test_control(gui2::label(gui2::implementation::builder_label(config())));
}
static void test_grid()
{
/* An empty grid behaves the same as a control so test here. */
test_control<gui2::grid>();
test_control(gui2::grid());
//std::cerr << __func__ << ": Detailed test.\n";