From 6c1948f2e1641cbd3a47b5491ed0c5d14ee81968 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 3 Jan 2018 14:07:11 -0500 Subject: [PATCH 35/42] FIXME: WIP on strong-using-pr83624.C --- gcc/cp/name-lookup.c | 3 ++- gcc/testsuite/g++.dg/lookup/strong-using-pr83624.C | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/strong-using-pr83624.C diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index acd0f84..4643a65 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -7017,7 +7017,8 @@ finish_namespace_using_directive (tree target, tree attribs) if (is_attribute_p ("strong", name)) { warning (0, "strong using directive no longer supported"); - if (CP_DECL_CONTEXT (target) == current_namespace) + if (CP_DECL_CONTEXT (target) == current_namespace + && cxx_dialect >= cxx11) inform (DECL_SOURCE_LOCATION (target), "you may use an inline namespace instead"); } diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-pr83624.C b/gcc/testsuite/g++.dg/lookup/strong-using-pr83624.C new file mode 100644 index 0000000..ab45121 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/strong-using-pr83624.C @@ -0,0 +1,6 @@ +// { dg-do compile { target c++98_only } } +// We shouldn't recommend inline namespaces when using pre-C++11 +// (PR c++/83624) + +namespace my_ns {} +using namespace my_ns __attribute__((__strong__)); -- 1.8.5.3