Fix another case of giving the wrong value kind to a dependent cast to

a non-dependent type.

llvm-svn: 120384
This commit is contained in:
John McCall 2010-11-30 02:05:44 +00:00
parent 6c7f64e0bc
commit 4cec5f806b
2 changed files with 13 additions and 1 deletions

View File

@ -1375,13 +1375,16 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, ExprValueKind &VK,
return false;
}
// Make sure we determine the value kind before we bail out for
// dependent types.
VK = Expr::getValueKindForType(CastTy);
// If the type is dependent, we won't do any other semantic analysis now.
if (CastTy->isDependentType() || CastExpr->isTypeDependent()) {
Kind = CK_Dependent;
return false;
}
VK = Expr::getValueKindForType(CastTy);
if (VK == VK_RValue && !CastTy->isRecordType())
DefaultFunctionArrayLvalueConversion(CastExpr);

View File

@ -52,3 +52,12 @@ namespace test4 {
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
}
namespace test5 {
template <typename T> class chained_map {
int k;
void lookup() const {
int &v = (int &)k;
}
};
}