File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -468,7 +468,7 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
468
468
469
469
// Possibly diagnose casts to enum types if the target type does not
470
470
// have a fixed size.
471
- if (CE->getType ()->isEnumeralType ()) {
471
+ if (Ctx. getLangOpts (). CPlusPlus && CE->getType ()->isEnumeralType ()) {
472
472
if (const auto *ET = CE->getType ().getCanonicalType ()->getAs <EnumType>();
473
473
ET && !ET->getDecl ()->isFixed ()) {
474
474
if (!this ->emitCheckEnumValue (*FromT, ET->getDecl (), CE))
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wcovered-switch-default -triple x86_64-linux-gnu %s
2
+ // RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wcovered-switch-default -triple x86_64-linux-gnu %s -fexperimental-new-constant-interpreter
2
3
void f (int z ) {
3
4
while (z ) {
4
5
default : z -- ; // expected-error {{statement not in switch}}
You can’t perform that action at this time.
0 commit comments