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 | 3df87678694de01bb51851f3555629a869627c26 (patch) | |
| tree | c1cfd4d995412851a1992e44452b2ba2e23324fd /clang/lib/Sema/SemaExpr.cpp | |
| parent | 9ab0319b2b2c14ab96d39d82afe6c6a0e919670d (diff) | |
| download | bcm5719-llvm-3df87678694de01bb51851f3555629a869627c26.tar.gz bcm5719-llvm-3df87678694de01bb51851f3555629a869627c26.zip | |
Patch for code gen. for c-style cast which ends in
using class's conversion functions [12.3.2-p2]
llvm-svn: 80433
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 474ddf06355..cfb9eb658de 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3060,6 +3060,19 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, TypeTy *Ty, if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr, Kind, ConversionDecl)) return ExprError(); + if (ConversionDecl) { + // encounterred a c-style cast requiring a conversion function. + if (CXXConversionDecl *CD = dyn_cast<CXXConversionDecl>(ConversionDecl)) { + castExpr = + new (Context) CXXFunctionalCastExpr(castType.getNonReferenceType(), + castType, LParenLoc, + CastExpr::CK_UserDefinedConversion, + castExpr, CD, + RParenLoc); + Kind = CastExpr::CK_UserDefinedConversion; + } + // FIXME. AST for when dealing with conversion functions (FunctionDecl). + } Op.release(); return Owned(new (Context) CStyleCastExpr(castType.getNonReferenceType(), |

