From 693745f801168958f0538c4506407c2948e9c68d Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 4 Dec 2023 16:06:47 -0800 Subject: Fix C++20 build The warning/error here was about using bitwise operator on incompatible enum values. Bug: 311052584 Test: trusty/vendor/google/aosp/scripts/build.py generic-arm64-test-debug Change-Id: I5de60907ebb22bcc6d02b09ca9ce1151cfc0b9f5 --- include/keymaster/keymaster_tags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/keymaster/keymaster_tags.h b/include/keymaster/keymaster_tags.h index 29eae7c..dbd195c 100644 --- a/include/keymaster/keymaster_tags.h +++ b/include/keymaster/keymaster_tags.h @@ -102,7 +102,7 @@ template class TypedTag { // Ensure that it's impossible to create a TypedTag instance whose 'tag' doesn't have type // 'tag_type'. Attempting to instantiate a tag with the wrong type will result in a compile // error (no match for template specialization StaticAssert), with no run-time cost. - StaticAssert<(tag & tag_type) == tag_type>::check(); + StaticAssert<(static_cast(tag) & tag_type) == tag_type>::check(); StaticAssert<(tag_type != KM_ENUM) && (tag_type != KM_ENUM_REP)>::check(); } // NOLINTNEXTLINE(google-explicit-constructor) @@ -120,7 +120,7 @@ class TypedEnumTag { // Ensure that it's impossible to create a TypedTag instance whose 'tag' doesn't have type // 'tag_type'. Attempting to instantiate a tag with the wrong type will result in a compile // error (no match for template specialization StaticAssert), with no run-time cost. - StaticAssert<(tag & tag_type) == tag_type>::check(); + StaticAssert<(static_cast(tag) & tag_type) == tag_type>::check(); StaticAssert<(tag_type == KM_ENUM) || (tag_type == KM_ENUM_REP)>::check(); } // NOLINTNEXTLINE(google-explicit-constructor) -- cgit v1.2.3