forked from OSchip/llvm-project
Don't crash while printing APValues that are lvalues casted to a
decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>. llvm-svn: 173747
This commit is contained in:
parent
0cdcc98200
commit
0b7bc7f996
|
@ -348,6 +348,8 @@ void APValue::printPretty(raw_ostream &Out, ASTContext &Ctx, QualType Ty) const{
|
||||||
bool IsReference = Ty->isReferenceType();
|
bool IsReference = Ty->isReferenceType();
|
||||||
QualType InnerTy
|
QualType InnerTy
|
||||||
= IsReference ? Ty.getNonReferenceType() : Ty->getPointeeType();
|
= IsReference ? Ty.getNonReferenceType() : Ty->getPointeeType();
|
||||||
|
if (InnerTy.isNull())
|
||||||
|
InnerTy = Ty;
|
||||||
|
|
||||||
if (!hasLValuePath()) {
|
if (!hasLValuePath()) {
|
||||||
// No lvalue path: just print the offset.
|
// No lvalue path: just print the offset.
|
||||||
|
|
|
@ -594,3 +594,16 @@ static const bool or_value = and_or<true>::or_value;
|
||||||
|
|
||||||
static_assert(and_value == false, "");
|
static_assert(and_value == false, "");
|
||||||
static_assert(or_value == true, "");
|
static_assert(or_value == true, "");
|
||||||
|
|
||||||
|
namespace rdar13090123 {
|
||||||
|
typedef __INTPTR_TYPE__ intptr_t;
|
||||||
|
|
||||||
|
constexpr intptr_t f(intptr_t x) {
|
||||||
|
return (((x) >> 21) * 8); // expected-note{{subexpression not valid in a constant expression}}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int foo;
|
||||||
|
|
||||||
|
constexpr intptr_t i = f((intptr_t)&foo - 10); // expected-error{{constexpr variable 'i' must be initialized by a constant expression}} \
|
||||||
|
// expected-note{{in call to 'f((char*)&foo + -10)'}}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue