]> granicus.if.org Git - clang/commitdiff
[clang] Don't segfault on incorrect using directive (PR41400)
authorGauthier Harnisch <tyker1@outlook.com>
Fri, 14 Jun 2019 08:25:52 +0000 (08:25 +0000)
committerGauthier Harnisch <tyker1@outlook.com>
Fri, 14 Jun 2019 08:25:52 +0000 (08:25 +0000)
Summary:
this is a bugfixe for [[ https://bugs.llvm.org/show_bug.cgi?id=41400 | PR41400 ]]

added nullptr check at the relevent place and test

Reviewers: rsmith, riccibruno

Reviewed By: rsmith

Subscribers: jkooker, jkorous, riccibruno, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60523

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363360 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprCXX.cpp
test/SemaCXX/using-decl-1.cpp

index 2e5d1c7c38f01af4e4d66e538f4373884a39175c..b59f3faa6e6618e2813ba65991d2e5a33391124a 100644 (file)
@@ -90,7 +90,7 @@ ParsedType Sema::getConstructorName(IdentifierInfo &II,
   // 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);
   }
index 93f38f28e778566496bb606e97583df73289a3c8..b4477e2c6245b692124742b5eb94bc3f6d30e790 100644 (file)
@@ -396,3 +396,10 @@ namespace tag_vs_var {
   using N::Y;
   using N::Z;
 }
+
+// expected-error@+5 {{requires a qualified name}}
+// expected-error@+4 {{expected ';'}}
+// expected-error@+3 {{expected '}'}}
+// expected-note@+2 {{to match this '{'}}
+// expected-error@+1 {{expected ';'}}
+template<class> struct S { using S
\ No newline at end of file