Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!
llvm-svn: 164590
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index fc2d1d6..01aaf8b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5210,11 +5210,12 @@
NewFD->setImplicitlyInline();
}
- // if this is a method defined in an __interface, set pure
- // (isVirtual will already return true)
- if (CXXRecordDecl *Parent = dyn_cast<CXXRecordDecl>(
- NewFD->getDeclContext())) {
- if (Parent->getTagKind() == TTK_Interface)
+ // If this is a method defined in an __interface, and is not a constructor
+ // or an overloaded operator, then set the pure flag (isVirtual will already
+ // return true).
+ if (const CXXRecordDecl *Parent =
+ dyn_cast<CXXRecordDecl>(NewFD->getDeclContext())) {
+ if (Parent->isInterface() && cast<CXXMethodDecl>(NewFD)->isUserProvided())
NewFD->setPure(true);
}