erichkeane added a comment.

In D130058#3688049 <https://reviews.llvm.org/D130058#3688049>, @thakis wrote:

> Here's a reduced repro of one case:
>
>   % cat test.cc
>   typedef enum VkResult {
>       VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000,
>       VK_RESULT_MAX_ENUM = 0x7FFFFFFF
>   } VkResult;
>   
>   constexpr VkResult VK_FAKE_DEVICE_OOM_FOR_TESTING = 
> static_cast<VkResult>(VK_RESULT_MAX_ENUM - 1);
>   
>   % out/gn/bin/clang -c test.cc -std=c++17
>   test.cc:6:20: error: constexpr variable 'VK_FAKE_DEVICE_OOM_FOR_TESTING' 
> must be initialized by a constant expression
>   constexpr VkResult VK_FAKE_DEVICE_OOM_FOR_TESTING = 
> static_cast<VkResult>(VK_RESULT_MAX_ENUM - 1);
>                      ^                                
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   test.cc:6:53: note: integer value 2147483646 is outside the valid range of 
> values [-2147483648, -2147483648) for this enumeration type
>   constexpr VkResult VK_FAKE_DEVICE_OOM_FOR_TESTING = 
> static_cast<VkResult>(VK_RESULT_MAX_ENUM - 1);
>                                                       ^
>   1 error generated.
>
> Isn't `valid range of values [-2147483648, -2147483648)` just wrong here?

That range with the leading negative looks wrong to me, but perhaps that is a 
diagnostic problem?  Either way, this test case SHOULD work, that range should 
be correct.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130058/new/

https://reviews.llvm.org/D130058

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to