================ @@ -200,14 +200,7 @@ namespace LongInt { }; enum shiftof { - X = (1<<-29), // all-error {{expression is not an integral constant expression}} \ - // all-note {{negative shift count -29}} - - X2 = (-1<<29), // cxx17-error {{expression is not an integral constant expression}} \ - // cxx17-note {{left shift of negative value -1}} \ - // ref-cxx17-error {{expression is not an integral constant expression}} \ - // ref-cxx17-note {{left shift of negative value -1}} - - X3 = (1<<32) // all-error {{expression is not an integral constant expression}} \ - // all-note {{shift count 32 >= width of type 'int'}} + X = (1<<-29), + X2 = (-1<<29), + X3 = (1<<32), ---------------- zygoloid wrote:
It's concerning that we don't produce a warning by default for constant-folding this, especially given that GCC does not constant-fold bad shifts. I'm not sure it's OK that we start silently accepting this invalid code by default. I wonder if we could reasonably refuse to constant-fold if the evaluation had UB? https://github.com/llvm/llvm-project/pull/99579 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits