From: Richard Smith Date: Thu, 5 Apr 2012 23:13:23 +0000 (+0000) Subject: Point the caret at the error for the 'expected namespace name' diagnostic in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf9658c3c200ee19bf0b6b157149f2376e39d270;p=clang Point the caret at the error for the 'expected namespace name' diagnostic in a namespace alias declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154138 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index e5dc4f5ac9..fb34126943 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -6742,7 +6742,7 @@ Decl *Sema::ActOnNamespaceAliasDef(Scope *S, if (R.empty()) { if (!TryNamespaceTypoCorrection(*this, R, S, SS, IdentLoc, Ident)) { - Diag(NamespaceLoc, diag::err_expected_namespace_name) << SS.getRange(); + Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange(); return 0; } } diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp index 52cae2e92f..e18b58b4d4 100644 --- a/test/SemaCXX/namespace-alias.cpp +++ b/test/SemaCXX/namespace-alias.cpp @@ -11,9 +11,13 @@ namespace C { } // expected-note {{previous definition is here}} namespace C = N; // expected-error {{redefinition of 'C'}} int i; -namespace D = i; // expected-error {{expected namespace name}} +namespace D = +i; // expected-error {{expected namespace name}} -namespace E = N::Foo; // expected-error {{expected namespace name}} +namespace E1 = N:: +Foo; // expected-error {{expected namespace name}} +namespace E2 = N:: +X; // expected-error {{expected namespace name}} namespace F { namespace A { namespace B { } } // expected-note {{candidate found by name lookup is 'F::A::B'}}