[PATCH] D131307: [Clang] Allow downgrading to a warning the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 17:38:36 PDT 2022


shafik added a comment.

In D131307#3713011 <https://reviews.llvm.org/D131307#3713011>, @sberg wrote:

> With this commit,
>
>   $ cat test.cc
>   #include "boost/numeric/conversion/cast.hpp"
>   int main() { return boost::numeric_cast<int>(0L); }
>   
>   $ clang++ test.cc
>
> succeeds without any diagnostic, while with its parent commit https://github.com/llvm/llvm-project/commit/b3645353041818f61e2580635409ddb81ff5a272 " [Clang] Diagnose ill-formed constant expression when setting a non fixed enum to a value outside the range of the enumeration values" it had started to fail with

Yes, that is intended. When modifying the change to allow it to be turned into a warning it started applying outside of constant expression contexts and that broke a lot more stuff.

I am planning on adding a default to a warning diagnostic for the non-constant expression cases but that will be done separately. I wanted to help folks unbreak their builds first.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131307



More information about the cfe-commits mailing list