[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)
Lei Wang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 09:26:23 PDT 2025
wlei-llvm wrote:
> > Internally, we discovered that this patch breaks Boost as used by MySQL. I don't have a full external reproducer at the moment and I don't know whether the code is valid or not, but I wanted to give a heads up that we may need to revisit this. This seems like the kind of incompatibility that would get reported during release testing later on.
>
> +1, this also breaks our internal Boost which is on 1.77.0. I'm checking out the latest Boost to verify if there is already a fix.
>
> @rnk Do you know yet if it also breaks the latest Boost?
>
> I found some related fixes in Boost that may help: [boostorg/numeric_conversion at 50a1eae](https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a)
>
> [percona/percona-server-mongodb at 8e1167e](https://github.com/percona/percona-server-mongodb/commit/8e1167e3389f8df77e8794dcb8d4dece9e5d674d)
JFYI, backporting https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a?fbclid=IwY2xjawK9JA1leHRuA2FlbQIxMQBicmlkETFwWjFtb3JJaWRrNWNSYlZXAR5AdfRqNL1nDOUfpxRcrFyszDejF-qEjXb_H0f82unnsTPFqOYsRiDlItWLRw_aem_dNRSalHTNq6FUW_hRNhJrQ
fixes our issue.
we got the same repro:
```
enum int_float_mixture_enum {
integral_to_integral,
};
template <typename T, T N> struct integral_c {
static const T value = N;
static const T prior_value = T((N - 1));
typedef integral_c<T, prior_value> prior;
};
integral_c<int_float_mixture_enum, integral_to_integral> a;
```
https://github.com/llvm/llvm-project/pull/143034
More information about the cfe-commits
mailing list