forked from OSchip/llvm-project
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:
parent
6c7f64e0bc
commit
4cec5f806b
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue