summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-04-08 09:59:01 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-04-09 17:39:06 +0000
commit336405b85e88fdc46896437cb02fe52b46079369 (patch)
tree72b7b7f6992ebe050ccfd320f067dffc91cad1c6
parentb5a0f16dca8324492a8b2bd69c82f3438e02fa16 (diff)
downloadphosphor-host-ipmid-336405b85e88fdc46896437cb02fe52b46079369.zip
phosphor-host-ipmid-336405b85e88fdc46896437cb02fe52b46079369.tar.gz
Add error message to build to make packing type errors clear
Because the base template actually handles things (all integer types), it needs to ward off non-integer types in a clear way, rather than relying on the user seeing that a tuple doesn't have an operator <<(), for example. This provides a clear message if a specialized pack operation was not hit. Tested-by: attempted to build with a non-supported pack type Change-Id: I66280831e88b4eac903b89f523e5f1a56a53cf9d Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
-rw-r--r--include/ipmid/message/pack.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index b458af4..8a9abe1 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -75,6 +75,8 @@ struct PackSingle
*/
static int op(Payload& p, const T& t)
{
+ static_assert(std::is_integral_v<T>,
+ "Attempt to pack a type that has no IPMI pack operation");
// if not on a byte boundary, must pack values LSbit/LSByte first
if (p.bitCount)
{
OpenPOWER on IntegriCloud