[PATCH] D60523: [clang] Don't segfault on incorrect using directive (PR41400)

Tyker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 01:25:23 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL363360: [clang] Don't segfault on incorrect using directive (PR41400) (authored by Tyker, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60523?vs=194552&id=204720#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60523/new/

https://reviews.llvm.org/D60523

Files:
  cfe/trunk/lib/Sema/SemaExprCXX.cpp
  cfe/trunk/test/SemaCXX/using-decl-1.cpp


Index: cfe/trunk/test/SemaCXX/using-decl-1.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/using-decl-1.cpp
+++ cfe/trunk/test/SemaCXX/using-decl-1.cpp
@@ -396,3 +396,10 @@
   using N::Y;
   using N::Z;
 }
+
+// expected-error at +5 {{requires a qualified name}}
+// expected-error at +4 {{expected ';'}}
+// expected-error at +3 {{expected '}'}}
+// expected-note at +2 {{to match this '{'}}
+// expected-error at +1 {{expected ';'}}
+template<class> struct S { using S
\ No newline at end of file
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp
@@ -90,7 +90,7 @@
   // When naming a constructor as a member of a dependent context (eg, in a
   // friend declaration or an inherited constructor declaration), form an
   // unresolved "typename" type.
-  if (CurClass->isDependentContext() && !EnteringContext) {
+  if (CurClass->isDependentContext() && !EnteringContext && SS.getScopeRep()) {
     QualType T = Context.getDependentNameType(ETK_None, SS.getScopeRep(), &II);
     return ParsedType::make(T);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60523.204720.patch
Type: text/x-patch
Size: 1188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190614/5421d1a8/attachment-0001.bin>


More information about the cfe-commits mailing list