Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
6.8.2
-
None
-
clang
Description
QNetworkRequest contains an enum 'Attribute'. It is defined like this:
HttpStatusCodeAttribute,
HttpReasonPhraseAttribute,
... more attributes
User = 1000,
UserMax = 32767
The idea was obviously, that User+1 and User+2 could also be used. But they are not part of the enum and thus C++ forbids using them (the underlying datatype might have no representation for these values thus using User+1 might end up in undefined behaviour).
A fix would be enum values for User1, User2, User3, ... up to User32767. In C89, this would not be an issue but I am using C++17.
clang directly generates a warning that this is undefined behaviour:
The value '1001' provided to the cast expression is not in the valid range of values for 'Attribute' [clang-analyzer-optin.core.EnumCastOutOfRange]