Skip to content

Commit 549f444

Browse files
committed
Backport better workaround for problem with static_assert(false) in gcc/clang compilers
1 parent 71f51d9 commit 549f444

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/common/utils_proto.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ namespace fb_utils
267267
bool isBpbSegmented(unsigned parLength, const unsigned char* par);
268268

269269

270+
// Workaround, to be removed with C++ 23
271+
template <typename... T>
272+
constexpr bool fb_always_false_v = false;
273+
270274
// Put integer value into info buffer
271275
template<typename T>
272276
inline unsigned char* putInfoItemInt(const unsigned char item, T value,
@@ -300,7 +304,7 @@ namespace fb_utils
300304
else if constexpr (len == sizeof(char))
301305
*ptr = value;
302306
else
303-
static_assert(len == 0, "unknown data type");
307+
static_assert(fb_always_false_v<T>, "unknown data type");
304308

305309
ptr += len;
306310
return ptr;

0 commit comments

Comments
 (0)