forked from OSchip/llvm-project
If we're generating code to create a pointer-to-member function
aggregate and the result of the aggregate is unused, bail out early. Fixes PR7027. llvm-svn: 102942
This commit is contained in:
parent
937a5b75f9
commit
aee1f51485
|
@ -321,6 +321,11 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) {
|
|||
(void) MPT;
|
||||
assert(MPT->getPointeeType()->isFunctionProtoType() &&
|
||||
"Unexpected member pointer type!");
|
||||
|
||||
// The creation of member function pointers has no side effects; if
|
||||
// there is no destination pointer, we have nothing to do.
|
||||
if (!DestPtr)
|
||||
return;
|
||||
|
||||
const DeclRefExpr *DRE = cast<DeclRefExpr>(E->getSubExpr());
|
||||
const CXXMethodDecl *MD =
|
||||
|
@ -329,6 +334,7 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) {
|
|||
const llvm::Type *PtrDiffTy =
|
||||
CGF.ConvertType(CGF.getContext().getPointerDiffType());
|
||||
|
||||
|
||||
llvm::Value *DstPtr = Builder.CreateStructGEP(DestPtr, 0, "dst.ptr");
|
||||
llvm::Value *FuncPtr;
|
||||
|
||||
|
|
|
@ -184,3 +184,9 @@ namespace PR6258 {
|
|||
void (A::*pf)(bool) = &A::f;
|
||||
}
|
||||
}
|
||||
|
||||
// PR7027
|
||||
namespace PR7027 {
|
||||
struct X { void test( ); };
|
||||
void testX() { &X::test; }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue