diff options
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Index/load-decls.c | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3f94bdc6697..5fb5cbaa450 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -7745,7 +7745,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, ECD->setInitVal(InitVal); // Adjust the Expr initializer and type. - if (ECD->getInitExpr()) + if (ECD->getInitExpr() && NewTy != ECD->getInitExpr()->getType()) ECD->setInitExpr(ImplicitCastExpr::Create(Context, NewTy, CK_IntegralCast, ECD->getInitExpr(), diff --git a/clang/test/Index/load-decls.c b/clang/test/Index/load-decls.c index cf88f4285c6..e0617c07df4 100644 --- a/clang/test/Index/load-decls.c +++ b/clang/test/Index/load-decls.c @@ -12,5 +12,4 @@ enum Color { // CHECK: load-decls.c:3:3: EnumConstantDecl=Green:3:3 (Definition) Extent=[3:3 - 3:8] // CHECK: load-decls.c:4:3: EnumConstantDecl=Blue:4:3 (Definition) Extent=[4:3 - 4:7] // CHECK: load-decls.c:6:3: EnumConstantDecl=Rouge:6:3 (Definition) Extent=[6:3 - 6:14] -// CHECK: load-decls.c:6:11: UnexposedExpr=Red:2:3 Extent=[6:11 - 6:14] // CHECK: load-decls.c:6:11: DeclRefExpr=Red:2:3 Extent=[6:11 - 6:14] |

