Skip to content

Commit 38c703d

Browse files
author
git apple-llvm automerger
committed
Merge commit '0364bafdadb7' from llvm.org/main into next
2 parents cd33094 + 0364baf commit 38c703d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/lib/Sema/SemaCXXScopeSpec.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,11 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
780780

781781
if (!Found.empty()) {
782782
const auto *ND = Found.getAsSingle<NamedDecl>();
783+
if (!ND) {
784+
Diag(IdInfo.IdentifierLoc, diag::err_expected_class_or_namespace)
785+
<< IdInfo.Identifier << getLangOpts().CPlusPlus;
786+
return true;
787+
}
783788
if (::ExtendNestedNameSpecifier(*this, SS, ND, IdInfo.IdentifierLoc,
784789
IdInfo.CCLoc)) {
785790
const Type *T = SS.getScopeRep().getAsType();

clang/test/Sema/PR166843.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -fsyntax-only %s -verify
2+
namespace a {
3+
template <class b>
4+
void c() {
5+
((::c::x)); // expected-error {{'c' is not a class, namespace, or enumeration}}
6+
}
7+
}

0 commit comments

Comments
 (0)