diff options
| author | Gauthier Harnisch <tyker1@outlook.com> | 2019-06-14 08:25:52 +0000 |
|---|---|---|
| committer | Gauthier Harnisch <tyker1@outlook.com> | 2019-06-14 08:25:52 +0000 |
| commit | ef629c7ef8c2179378fa996d3ccd699a5f275447 (patch) | |
| tree | 2d337bdb7bb13da5e0ea5d41acb743b3329c3b00 | |
| parent | d46ebd207bc63d25a34c2ae45e0da1778ece7ac3 (diff) | |
| download | bcm5719-llvm-ef629c7ef8c2179378fa996d3ccd699a5f275447.tar.gz bcm5719-llvm-ef629c7ef8c2179378fa996d3ccd699a5f275447.zip | |
[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
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/using-decl-1.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 2e5d1c7c38f..b59f3faa6e6 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -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); } diff --git a/clang/test/SemaCXX/using-decl-1.cpp b/clang/test/SemaCXX/using-decl-1.cpp index 93f38f28e77..b4477e2c624 100644 --- a/clang/test/SemaCXX/using-decl-1.cpp +++ b/clang/test/SemaCXX/using-decl-1.cpp @@ -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 |

