diff options
author | Anders Carlsson <andersca@mac.com> | 2009-10-03 16:30:22 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-10-03 16:30:22 +0000 |
commit | 26bc220377705292a0519a71d3ea3aef68fcfec6 (patch) | |
tree | 583b838e13dc8dc9a30afd977b7573eb38c4374a | |
parent | a024d17048cd7fb71bfaee3876993ef2c27057be (diff) |
Ignore No-op casts when evaluating lvalue expressions. Fixes PR5122.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83267 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ExprConstant.cpp | 10 | ||||
-rw-r--r-- | test/CodeGenCXX/references.cpp | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 2aefae6fd7..94d22998eb 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -180,6 +180,16 @@ public: { return Visit(E->getSubExpr()); } APValue VisitChooseExpr(const ChooseExpr *E) { return Visit(E->getChosenSubExpr(Info.Ctx)); } + + APValue VisitCastExpr(CastExpr *E) { + switch (E->getCastKind()) { + default: + return APValue(); + + case CastExpr::CK_NoOp: + return Visit(E->getSubExpr()); + } + } // FIXME: Missing: __real__, __imag__ }; } // end anonymous namespace diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp index 6f4c1032ef..c235521d43 100644 --- a/test/CodeGenCXX/references.cpp +++ b/test/CodeGenCXX/references.cpp @@ -95,3 +95,8 @@ struct A { void f(A* a) { int b = a->b(); } + +// PR5122 +void *foo = 0; +void * const & kFoo = foo; + |