From: Douglas Gregor Date: Mon, 14 Nov 2011 23:00:43 +0000 (+0000) Subject: When we're checking access in a dependent context, don't try to look X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7432b90e88ac9e219f6e8a3151c097b0b7da933c;p=clang When we're checking access in a dependent context, don't try to look at the bases of an undefined class. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144582 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 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 +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(m_refData)->IsOk();