Skip to content

Commit

Permalink
Resolve compiler error with GCC 5.4
Browse files Browse the repository at this point in the history
Simply always using double braces ({{}}) for std::array initialization
resolved the issue.
  • Loading branch information
Thomas Grützmacher committed Mar 13, 2021
1 parent b529750 commit bb6a728
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions core/test/accessor/block_col_major.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,19 @@ class BlockColMajorAccessor3d : public ::testing::Test {
*/
};
// clang-format on
const std::array<gko::acc::size_type, dimensionality> dim1{2, 3, 4};
const std::array<gko::acc::size_type, dimensionality> dim2{2, 2, 3};
const std::array<gko::acc::size_type, dimensionality> dim1{{2, 3, 4}};
const std::array<gko::acc::size_type, dimensionality> dim2{{2, 2, 3}};
blk_col_major_range default_r{data, dim1};
blk_col_major_range custom_r{
data, dim2, std::array<gko::acc::size_type, dimensionality - 1>{12, 3}};
data, dim2,
std::array<gko::acc::size_type, dimensionality - 1>{{12, 3}}};
};


TEST_F(BlockColMajorAccessor3d, ComputesCorrectStride)
{
auto range_stride = default_r.get_accessor().stride;
auto check_stride = std::array<gko::acc::size_type, 2>{12, 3};
auto check_stride = std::array<gko::acc::size_type, 2>{{12, 3}};

ASSERT_EQ(range_stride, check_stride);
}
Expand Down
12 changes: 6 additions & 6 deletions core/test/accessor/row_major.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class RowMajorAccessor : public ::testing::Test {
5, 6, -3
};
// clang-format on
row_major_int_range r{data, dim_type{3u, 2u}, stride_type{3u}};
row_major_int_range r{data, dim_type{{3u, 2u}}, stride_type{{3u}}};
};


TEST_F(RowMajorAccessor, CanCreateWithDim)
{
row_major_int_range r2{data, dim_type{3, 2}, stride_type{3u}};
row_major_int_range r2{data, dim_type{{3, 2}}, stride_type{{3u}}};

EXPECT_EQ(r2(0, 0), 1);
EXPECT_EQ(r2(0, 1), 2);
Expand All @@ -85,7 +85,7 @@ TEST_F(RowMajorAccessor, CanCreateWithDim)

TEST_F(RowMajorAccessor, CanCreateDefaultStride)
{
row_major_int_range r2{data, dim_type{3, 3}};
row_major_int_range r2{data, dim_type{{3, 3}}};

EXPECT_EQ(r2(0, 0), 1);
EXPECT_EQ(r2(0, 1), 2);
Expand Down Expand Up @@ -175,11 +175,11 @@ class RowMajorAccessor3d : public ::testing::Test {
29, 30, 31, 32
};
// clang-format on
const std::array<gko::acc::size_type, dimensionality> dim1{2, 3, 4};
const std::array<gko::acc::size_type, dimensionality> dim2{2, 2, 3};
const std::array<gko::acc::size_type, dimensionality> dim1{{2, 3, 4}};
const std::array<gko::acc::size_type, dimensionality> dim2{{2, 2, 3}};
row_major_int_range default_r{data, dim1};
row_major_int_range custom_r{
data, dim2, std::array<gko::size_type, dimensionality - 1>{12, 4}};
data, dim2, std::array<gko::size_type, dimensionality - 1>{{12, 4}}};
};


Expand Down

0 comments on commit bb6a728

Please sign in to comment.