[clang] Don't wrap immediate invocations in ConstantExprs within constexpr initializers (PR #89565)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 06:19:34 PDT 2024
================
@@ -244,8 +244,8 @@ namespace UndefinedBehavior {
constexpr int n13 = n5 + n5; // expected-error {{constant expression}} expected-note {{value -4294967296 is outside the range of }}
constexpr int n14 = n3 - n5; // expected-error {{constant expression}} expected-note {{value 4294967295 is outside the range of }}
constexpr int n15 = n5 * n5; // expected-error {{constant expression}} expected-note {{value 4611686018427387904 is outside the range of }}
- constexpr signed char c1 = 100 * 2; // ok expected-warning{{changes value}}
- constexpr signed char c2 = '\x64' * '\2'; // also ok expected-warning{{changes value}}
+ constexpr signed char c1 = 100 * 2; // ok - no error from changing value because initializer is constexpr.
----------------
erichkeane wrote:
Shouldn't this actually be an error? Signed overflow during constexpr?
https://github.com/llvm/llvm-project/pull/89565
More information about the cfe-commits
mailing list