diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-17 12:21:11 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-17 12:21:11 +0000 |
commit | bbca85d14c227641cb482ef497e1e567fe6f9c95 (patch) | |
tree | 87ec378fb3353c5aae8f57ff09c720e0355753c6 /lib/Sema/SemaDecl.cpp | |
parent | 28d5b724198b8b7449066dd2feb3b0276192f563 (diff) |
Avoid to emit redundant implicit cast for enum constants init expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3f94bdc669..5fb5cbaa45 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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(), |