Loosen the precondition of isCXXInstanceMember() to simply return

"false" for declarations that aren't members of classes. Fixes PR12106.

llvm-svn: 152284
This commit is contained in:
Douglas Gregor 2012-03-08 02:08:05 +00:00
parent dd1637c393
commit 3f28ec28d5
3 changed files with 15 additions and 5 deletions

View File

@ -205,8 +205,8 @@ public:
return DC->isRecord();
}
/// \brief Given that this declaration is a C++ class member,
/// determine whether it's an instance member of its class.
/// \brief Determine whether the given declaration is an instance member of
/// a C++ class.
bool isCXXInstanceMember() const;
class LinkageInfo {

View File

@ -997,9 +997,9 @@ NamedDecl *NamedDecl::getUnderlyingDecl() {
}
bool NamedDecl::isCXXInstanceMember() const {
assert(isCXXClassMember() &&
"checking whether non-member is instance member");
if (!isCXXClassMember())
return false;
const NamedDecl *D = this;
if (isa<UsingShadowDecl>(D))
D = cast<UsingShadowDecl>(D)->getTargetDecl();

View File

@ -174,3 +174,13 @@ namespace N2764 {
}
enum class N2764::B {};
namespace PR12106 {
template<typename E> struct Enum {
Enum() : m_e(E::Last) {}
E m_e;
};
enum eCOLORS { Last };
Enum<eCOLORS> e;
}