Tyker created this revision. Tyker added a reviewer: rsmith. Herald added a project: clang. Herald added a subscriber: cfe-commits.
this is a bugfixe for bugtracker <https://bugs.llvm.org/show_bug.cgi?id=41400> added nullptr check at the relevent place and test Repository: rC Clang https://reviews.llvm.org/D60523 Files: clang/lib/Sema/SemaExprCXX.cpp clang/test/SemaCXX/using-decl-1.cpp Index: clang/test/SemaCXX/using-decl-1.cpp =================================================================== --- clang/test/SemaCXX/using-decl-1.cpp +++ clang/test/SemaCXX/using-decl-1.cpp @@ -396,3 +396,10 @@ 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 Index: clang/lib/Sema/SemaExprCXX.cpp =================================================================== --- clang/lib/Sema/SemaExprCXX.cpp +++ clang/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); }
Index: clang/test/SemaCXX/using-decl-1.cpp =================================================================== --- clang/test/SemaCXX/using-decl-1.cpp +++ clang/test/SemaCXX/using-decl-1.cpp @@ -396,3 +396,10 @@ 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 Index: clang/lib/Sema/SemaExprCXX.cpp =================================================================== --- clang/lib/Sema/SemaExprCXX.cpp +++ clang/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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits