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) {
468468
469469 // Possibly diagnose casts to enum types if the target type does not
470470 // have a fixed size.
471- if (CE->getType ()->isEnumeralType ()) {
471+ if (Ctx. getLangOpts (). CPlusPlus && CE->getType ()->isEnumeralType ()) {
472472 if (const auto *ET = CE->getType ().getCanonicalType ()->getAs <EnumType>();
473473 ET && !ET->getDecl ()->isFixed ()) {
474474 if (!this ->emitCheckEnumValue (*FromT, ET->getDecl (), CE))
Original file line number Diff line number Diff line change 11// 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
23void f (int z ) {
34 while (z ) {
45 default : z -- ; // expected-error {{statement not in switch}}
You can’t perform that action at this time.
0 commit comments