Skip to content

Commit 710b262

Browse files
committed
Ensure correct diagnostic still gets used
1 parent 7010a50 commit 710b262

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clang/lib/Sema/SemaCXXScopeSpec.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,11 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
780780

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

clang/test/Sema/PR166843.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
namespace a {
33
template <class b>
44
void c() {
5-
((::c::)); // expected-error {{expected unqualified-id}}
5+
((::c::x)); // expected-error {{'c' is not a class, namespace, or enumeration}}
66
}
77
}

0 commit comments

Comments
 (0)