diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 22:47:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 22:47:22 +0000 |
commit | 19fc0b753a212bd4c20b779b6444d759beabeeb0 (patch) | |
tree | b3acf003bd3434db263999a97280c2da7d2e9388 /clang/lib | |
parent | ef3fdc1cbd5eefea2ede25a591023f52ca62c3ce (diff) | |
download | bcm5719-llvm-19fc0b753a212bd4c20b779b6444d759beabeeb0.tar.gz bcm5719-llvm-19fc0b753a212bd4c20b779b6444d759beabeeb0.zip |
Make sure that reinterpret_cast gets a CastKind on all successful
paths. Fixes "cannot compile this unexpected cast lvalue yet" error in
llvm/lib/Analysis/IPA/GlobalsModRef.cpp.
llvm-svn: 91932
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaCXXCast.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 92eb1740c97..c9b3b8ec34a 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -1053,8 +1053,11 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr, return TC_NotApplicable; // If both types have the same size, we can successfully cast. - if (Self.Context.getTypeSize(SrcType) == Self.Context.getTypeSize(DestType)) + if (Self.Context.getTypeSize(SrcType) + == Self.Context.getTypeSize(DestType)) { + Kind = CastExpr::CK_BitCast; return TC_Success; + } if (destIsScalar) msg = diag::err_bad_cxx_cast_vector_to_scalar_different_size; @@ -1083,6 +1086,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr, // to the same type. However, the behavior of compilers is pretty consistent // on this point: allow same-type conversion if the involved types are // pointers, disallow otherwise. + Kind = CastExpr::CK_NoOp; return TC_Success; } |