瀏覽代碼

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

Douglas Gregor 13 年之前
父節點
當前提交
7432b90e88
共有 2 個文件被更改,包括 18 次插入0 次删除
  1. 3 0
      lib/Sema/SemaAccess.cpp
  2. 15 0
      test/SemaTemplate/crash-10438657.cpp

+ 3 - 0
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) {
 

+ 15 - 0
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();