]> granicus.if.org Git - clang/commitdiff
When we're checking access in a dependent context, don't try to look
authorDouglas Gregor <dgregor@apple.com>
Mon, 14 Nov 2011 23:00:43 +0000 (23:00 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 14 Nov 2011 23:00:43 +0000 (23:00 +0000)
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

lib/Sema/SemaAccess.cpp
test/SemaTemplate/crash-10438657.cpp [new file with mode: 0644]

index 69fd543082c900525dd492a174e7c77cab6a795f..9bb8f616b64da412f09ecb1f73d30c4fe1beb16d 100644 (file)
@@ -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 (file)
index 0000000..2ee64bd
--- /dev/null
@@ -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();