diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-14 23:00:43 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-14 23:00:43 +0000 |
commit | 7432b90e88ac9e219f6e8a3151c097b0b7da933c (patch) | |
tree | a642ab08704a631f9613109d0002825d1309f089 | |
parent | c71d55469e7d5f7b376a30620617a175a9442da9 (diff) |
When we're checking access in a dependent context, don't try to look
at the bases of an undefined class. Fixes <rdar://problem/10438657>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144582 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaAccess.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/crash-10438657.cpp | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp index 69fd543082..9bb8f616b6 100644 --- a/lib/Sema/SemaAccess.cpp +++ b/lib/Sema/SemaAccess.cpp @@ -265,6 +265,9 @@ static AccessResult IsDerivedFromInclusive(const CXXRecordDecl *Derived, SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack while (true) { + if (Derived->isDependentContext() && !Derived->hasDefinition()) + return AR_dependent; + for (CXXRecordDecl::base_class_const_iterator I = Derived->bases_begin(), E = Derived->bases_end(); I != E; ++I) { diff --git a/test/SemaTemplate/crash-10438657.cpp b/test/SemaTemplate/crash-10438657.cpp new file mode 100644 index 0000000000..2ee64bdfcd --- /dev/null +++ b/test/SemaTemplate/crash-10438657.cpp @@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 -fsyntax-only %s 2> %t +// RUN: FileCheck %s < %t +// CHECK: 10 errors +template<typename _CharT> +class collate : public locale::facet { + +protected: +virtual ~collate() {} + class wxObject; + class __attribute__ ((visibility("default"))) wxGDIRefData + : public wxObjectRefData {}; + class __attribute__ ((visibility("default"))) wxGDIObject : public wxObject { \ + public: + virtual bool IsOk() const { + return m_refData && static_cast<wxGDIRefData *>(m_refData)->IsOk(); |