diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-29 19:15:16 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-29 19:15:16 +0000 |
| commit | 31976591dee494994f2546c72c23e1e35a9c1555 (patch) | |
| tree | 61bdb0e43f2bdddcdeccb99e4ac0fadb59a2772a /lib/CodeGen/CGExpr.cpp | |
| parent | d933a0198f3ccce9c73bf2951625315b911d37bf (diff) | |
| download | clang-31976591dee494994f2546c72c23e1e35a9c1555.tar.gz clang-31976591dee494994f2546c72c23e1e35a9c1555.tar.bz2 clang-31976591dee494994f2546c72c23e1e35a9c1555.tar.xz | |
Patch for code gen. for c-style cast which ends in
using class's conversion functions [12.3.2-p2]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
| -rw-r--r-- | lib/CodeGen/CGExpr.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 24442c3a73..400d45ffe5 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1173,8 +1173,13 @@ LValue CodeGenFunction::EmitConditionalOperator(const ConditionalOperator* E) { /// noop aggregate casts, and cast from scalar to union. LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { if (E->getCastKind() == CastExpr::CK_UserDefinedConversion) { - const CXXFunctionalCastExpr *CXXFExpr = cast<CXXFunctionalCastExpr>(E); - return LValue::MakeAddr(EmitCXXFunctionalCastExpr(CXXFExpr).getScalarVal(), 0); + if (const CXXFunctionalCastExpr *CXXFExpr = + dyn_cast<CXXFunctionalCastExpr>(E)) + return LValue::MakeAddr( + EmitCXXFunctionalCastExpr(CXXFExpr).getScalarVal(), 0); + assert(isa<CStyleCastExpr>(E) && + "EmitCastLValue - Expected CStyleCastExpr"); + return EmitLValue(E->getSubExpr()); } // If this is an aggregate-to-aggregate cast, just use the input's address as @@ -1188,10 +1193,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) { if (ICE->isLvalueCast()) return EmitLValue(E->getSubExpr()); - // FIXME: Implement this properly! - if (E->getCastKind() == CastExpr::CK_UserDefinedConversion) - return EmitUnsupportedLValue(E, "user-defined conversion"); - // Otherwise, we must have a cast from scalar to union. assert(E->getCastKind() == CastExpr::CK_ToUnion && "Expected scalar-to-union cast"); |
