From 8cb96cb69377b2cb97d391544d7b126f202d5081 Mon Sep 17 00:00:00 2001 From: Michael Marshall Date: Thu, 14 Feb 2019 19:17:12 +0000 Subject: [PATCH] Hmmm lots of warnings depending on compiler ... --- Grid/serialisation/BaseIO.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Grid/serialisation/BaseIO.h b/Grid/serialisation/BaseIO.h index 535ab035..531d0e41 100644 --- a/Grid/serialisation/BaseIO.h +++ b/Grid/serialisation/BaseIO.h @@ -120,11 +120,16 @@ namespace Grid { static constexpr std::size_t Dimension(unsigned int dim) { return ( dim == 0 ) ? N : Traits::Dimension(dim - 1); } static constexpr std::size_t DimensionNT(unsigned int dim) { + std::size_t DimSize = N; + bool bGotDimSize = false; if( N != 1 ) { - if( dim == 0 ) return N; + if( dim == 0 ) + bGotDimSize = true; dim--; } - return Traits::DimensionNT(dim); + if( !bGotDimSize ) + DimSize = Traits::DimensionNT(dim); + return DimSize; } }; template struct Traits> { @@ -138,11 +143,16 @@ namespace Grid { static constexpr std::size_t Dimension(unsigned int dim) { return ( dim == 0 || dim == 1 ) ? N : Traits::Dimension(dim - 2); } static constexpr std::size_t DimensionNT(unsigned int dim) { + std::size_t DimSize = N; + bool bGotDimSize = false; if( N != 1 ) { - if( dim == 0 || dim == 1 ) return N; + if( dim == 0 || dim == 1 ) + bGotDimSize = true; dim -= 2; } - return Traits::DimensionNT(dim); + if( !bGotDimSize ) + DimSize = Traits::DimensionNT(dim); + return DimSize; } }; template struct Traits> : Traits> {};