diff options
-rw-r--r-- | lib/Sema/SemaCXXCast.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/dependent-expr.cpp | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index 5997d98fa5..2a52f17876 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -161,6 +161,9 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, << Ex->getSourceRange(); ExprValueKind VK = VK_RValue; + if (TypeDependent) + VK = Expr::getValueKindForType(DestType); + switch (Kind) { default: llvm_unreachable("Unknown C++ cast!"); diff --git a/test/SemaTemplate/dependent-expr.cpp b/test/SemaTemplate/dependent-expr.cpp index e25afce77a..f3970d1d71 100644 --- a/test/SemaTemplate/dependent-expr.cpp +++ b/test/SemaTemplate/dependent-expr.cpp @@ -45,3 +45,10 @@ namespace PR7724 { template<typename OT> int myMethod() { return 2 && sizeof(OT); } } + +namespace test4 { + template <typename T> T *addressof(T &v) { + return reinterpret_cast<T*>( + &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); + } +} |