[PATCH] D32519: [Sema] Avoid using a null type pointer (fixes PR32750)

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 26 08:53:29 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL301420: [Sema] Avoid using a null type pointer (fixes PR32750) (authored by vedantk).

Changed prior to commit:
  https://reviews.llvm.org/D32519?vs=96668&id=96757#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32519

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp


Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -615,7 +615,7 @@
 
     CXXRecordDecl *RD = cast<CXXRecordDecl>(CurContext);
     for (const auto &Base : RD->bases())
-      if (Context.hasSameUnqualifiedType(QualType(Ty, 1), Base.getType()))
+      if (Ty && Context.hasSameUnqualifiedType(QualType(Ty, 1), Base.getType()))
         return true;
     return S->isFunctionPrototypeScope();
   }
Index: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
+++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
 // RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -fms-compatibility -verify -DTEST3
 
 #if TEST1
 
@@ -508,6 +509,13 @@
 // Check that __unaligned is not recognized if MS extensions are not enabled
 typedef char __unaligned *aligned_type; // expected-error {{expected ';' after top level declarator}}
 
+#elif TEST3
+
+namespace PR32750 {
+template<typename T> struct A {};
+template<typename T> struct B : A<A<T>> { A<T>::C::D d; }; // expected-error {{missing 'typename' prior to dependent type name 'A<T>::C::D'}}
+}
+
 #else
 
 #error Unknown test mode


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32519.96757.patch
Type: text/x-patch
Size: 1854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170426/a9755540/attachment.bin>


More information about the cfe-commits mailing list