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

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

llvm-svn: 363360
This commit is contained in:
Gauthier Harnisch 2019-06-14 08:25:52 +00:00
parent d46ebd207b
commit ef629c7ef8
2 changed files with 8 additions and 1 deletions

View 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);
}

View 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