Fixed a few compilation warnings

This commit is contained in:
Benoit Steiner 2016-01-31 16:48:50 -08:00
parent 3f1ee45833
commit 6720b38fbf
2 changed files with 12 additions and 5 deletions

View File

@ -41,7 +41,10 @@ class TensorStorage<T, FixedDimensions, Options_>
private:
static const std::size_t Size = FixedDimensions::total_size;
EIGEN_ALIGN_MAX T m_data[Size];
// Allocate an array of size at least one to prevent compiler warnings.
static const std::size_t MinSize = max_n_1<Size>::size;
EIGEN_ALIGN_MAX T m_data[MinSize];
FixedDimensions m_dimensions;
public:

View File

@ -16,16 +16,20 @@ static void test_empty_tensor()
{
Tensor<float, 2> source;
Tensor<float, 2> tgt1 = source;
Tensor<float, 2> tgt2;
tgt2 = source;
Tensor<float, 2> tgt2(source);
Tensor<float, 2> tgt3;
tgt3 = tgt1;
tgt3 = tgt2;
}
static void test_empty_fixed_size_tensor()
{
TensorFixedSize<float, Sizes<0>> source;
TensorFixedSize<float, Sizes<0>> tgt1 = source;
TensorFixedSize<float, Sizes<0>> tgt2;
tgt2 = source;
TensorFixedSize<float, Sizes<0>> tgt2(source);
TensorFixedSize<float, Sizes<0>> tgt3;
tgt3 = tgt1;
tgt3 = tgt2;
}