From cca2363dc8570b1bb861bc66e4f7826b91e92977 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 2 Sep 2016 17:30:29 -0400 Subject: [PATCH 22/44] FIXME: C++: WIP fixit for bogus explicit ns qualification --- gcc/cp/name-lookup.c | 9 +++++++-- gcc/testsuite/g++.dg/bogus-explicit-qualification.C | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/bogus-explicit-qualification.C diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 6ac24d8..231d607 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3499,8 +3499,13 @@ set_decl_namespace (tree decl, tree scope, bool friendp) if (scope == current_namespace) { if (at_namespace_scope_p ()) - error ("explicit qualification in declaration of %qD", - decl); + { + // FIXME: ideally there'd be a removal fixit about the stray + // namespace. But there doesn't seem to be a way to get at + // the location information. + error ("explicit qualification in declaration of %qD", + decl); + } return; } diff --git a/gcc/testsuite/g++.dg/bogus-explicit-qualification.C b/gcc/testsuite/g++.dg/bogus-explicit-qualification.C new file mode 100644 index 0000000..2393bd6 --- /dev/null +++ b/gcc/testsuite/g++.dg/bogus-explicit-qualification.C @@ -0,0 +1,9 @@ +namespace foo { + +void foo::bar (void) +{ +} + +} // namespace foo + + -- 1.8.5.3