Skip to content

Commit

Permalink
Attempt to fix build of unit tests on GCC 4.8
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jyrkive authored and Vultraz committed Aug 25, 2017
1 parent eff2fc6 commit cd68243
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/tests/gui/iterator.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 4 additions & 5 deletions src/tests/gui/visitor.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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";

Expand Down

0 comments on commit cd68243

Please sign in to comment.