From 577fb1c51decf689f64f25b63e8b9d5bc4cb2ca2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 1 Oct 2020 11:50:36 +0200 Subject: [PATCH] cpplint: Constructors where we want explicit conversion, should be explicit Signed-off-by: Gergely Nagy --- src/kaleidoscope/MatrixAddr.h | 2 +- src/kaleidoscope/bitfields.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/MatrixAddr.h b/src/kaleidoscope/MatrixAddr.h index a7a5cbbf..8e13ddbe 100644 --- a/src/kaleidoscope/MatrixAddr.h +++ b/src/kaleidoscope/MatrixAddr.h @@ -47,7 +47,7 @@ class MatrixAddr { constexpr MatrixAddr(uint8_t row, uint8_t col) : offset_(row * cols + col) {} - constexpr MatrixAddr(uint8_t offset) + explicit constexpr MatrixAddr(uint8_t offset) : offset_(offset) {} // Rely on the default copy and move constructor. diff --git a/src/kaleidoscope/bitfields.h b/src/kaleidoscope/bitfields.h index 3a59c854..52621143 100644 --- a/src/kaleidoscope/bitfields.h +++ b/src/kaleidoscope/bitfields.h @@ -113,7 +113,7 @@ class Bitfield : public internal::_BaseBitfield { static constexpr size_t n_bytes_ = nBytesForBits(BitCount__); template - constexpr Bitfield(Bits__...bits) : bits_(bits...) { + explicit constexpr Bitfield(Bits__...bits) : bits_(bits...) { static_assert(sizeof...(Bits__) == n_bits_, "Invalid number of bits supplied to Bitfield constructor. \n" "Compare the number of bits supplied with the provided template \n"