forked from OSchip/llvm-project
Apply array-to-pointer decay when instantiating a MemberExpr. Fixes
PR7405, patch by Kyle Lippincott! llvm-svn: 106523
This commit is contained in:
parent
de049cdbe6
commit
ef4a2a2b54
|
@ -1174,7 +1174,9 @@ public:
|
|||
SS.setScopeRep(Qualifier);
|
||||
}
|
||||
|
||||
QualType BaseType = ((Expr*) Base.get())->getType();
|
||||
Expr *BaseExpr = Base.takeAs<Expr>();
|
||||
getSema().DefaultFunctionArrayConversion(BaseExpr);
|
||||
QualType BaseType = BaseExpr->getType();
|
||||
|
||||
// FIXME: this involves duplicating earlier analysis in a lot of
|
||||
// cases; we should avoid this when possible.
|
||||
|
@ -1183,8 +1185,8 @@ public:
|
|||
R.addDecl(FoundDecl);
|
||||
R.resolveKind();
|
||||
|
||||
return getSema().BuildMemberReferenceExpr(move(Base), BaseType,
|
||||
OpLoc, isArrow,
|
||||
return getSema().BuildMemberReferenceExpr(getSema().Owned(BaseExpr),
|
||||
BaseType, OpLoc, isArrow,
|
||||
SS, FirstQualifierInScope,
|
||||
R, ExplicitTemplateArgs);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
struct mystruct {
|
||||
int member;
|
||||
};
|
||||
|
||||
template <int i>
|
||||
int foo() {
|
||||
mystruct s[1];
|
||||
return s->member;
|
||||
}
|
||||
|
||||
int main() {
|
||||
foo<1>();
|
||||
}
|
||||
|
||||
// PR7405
|
||||
struct hb_sanitize_context_t {
|
||||
int start;
|
||||
};
|
||||
template <typename Type> static bool sanitize() {
|
||||
hb_sanitize_context_t c[1];
|
||||
return !c->start;
|
||||
}
|
||||
bool closure = sanitize<int>();
|
Loading…
Reference in New Issue