Skip to content

Commit e40b7af

Browse files
committed
Addressing feedback.
1 parent 1998809 commit e40b7af

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def err_expected_semi_after_namespace_name : Error<
269269
def err_unexpected_namespace_attributes_alias : Error<
270270
"attributes cannot be specified on namespace alias">;
271271
def err_unexpected_qualified_namespace_alias : Error<
272-
"unexpected nested name specifier in namespace alias definition">;
272+
"namespace alias must be a single identifier">;
273273
def err_unexpected_nested_namespace_attribute : Error<
274274
"attributes cannot be specified on a nested namespace definition">;
275275
def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ Parser::DeclGroupPtrTy Parser::ParseNamespace(DeclaratorContext Context,
141141
return nullptr;
142142
}
143143
if (!ExtraNSs.empty()) {
144-
Diag(IdentLoc, diag::err_unexpected_qualified_namespace_alias);
144+
Diag(ExtraNSs.front().NamespaceLoc,
145+
diag::err_unexpected_qualified_namespace_alias)
146+
<< SourceRange(ExtraNSs.front().NamespaceLoc,
147+
ExtraNSs.back().IdentLoc);
145148
SkipUntil(tok::semi);
146149
return nullptr;
147150
}

clang/test/SemaCXX/namespace-alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace I {
4848

4949
namespace A2 = A1;
5050

51-
namespace A3::extra::specifiers = A2; // expected-error {{unexpected nested name specifier}}
51+
namespace A3::extra::specifiers = A2; // expected-error {{alias must be a single identifier}}
5252
}
5353

5454
int f() {

0 commit comments

Comments
 (0)