name-lookup.c (finish_using_directive): Don't issue inform() if the warning didn...
authorMarek Polacek <polacek@redhat.com>
Mon, 20 May 2019 19:04:52 +0000 (19:04 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 20 May 2019 19:04:52 +0000 (19:04 +0000)
* name-lookup.c (finish_using_directive): Don't issue inform() if the
warning didn't trigger.  Add quoting.  Tweak the inform message.

* g++.dg/lookup/strong-using2.C: New test.

From-SVN: r271432

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/strong-using2.C [new file with mode: 0644]

index 87ecd7c1f6fcf5bd3e0562ecb1bec69399a18b51..88275f0ed44acd300e43e4ba9b3f634eded8bc5c 100644 (file)
@@ -3,6 +3,9 @@
        * pt.c (convert_template_argument): Add a diagnostic for the
        [temp.arg]/2 ambiguity case.
 
+       * name-lookup.c (finish_using_directive): Don't issue inform() if the
+       warning didn't trigger.  Add quoting.  Tweak the inform message.
+
 2019-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * cp-tree.h: Remove remnants of CONV_NONCONVERTING.
index f7952eebe0cb94731b3c8cae101729a89f825714..476ba509231d233144e39e8b3434377e1b617c9e 100644 (file)
@@ -7258,10 +7258,10 @@ finish_using_directive (tree target, tree attribs)
        if (current_binding_level->kind == sk_namespace
            && is_attribute_p ("strong", name))
          {
-           warning (0, "strong using directive no longer supported");
-           if (CP_DECL_CONTEXT (target) == current_namespace)
+           if (warning (0, "%<strong%> using directive no longer supported")
+               && CP_DECL_CONTEXT (target) == current_namespace)
              inform (DECL_SOURCE_LOCATION (target),
-                     "you may use an inline namespace instead");
+                     "you can use an inline namespace instead");
          }
        else
          warning (OPT_Wattributes, "%qD attribute directive ignored", name);
index 0f4c81c21546eeba13c2ab876f79dca565cc9633..be4e7eb895f4a64817c606bc80f9afd586bd65de 100644 (file)
@@ -4,6 +4,8 @@
 
        * g++.dg/cpp2a/nontype-class17.C: New test.
 
+       * g++.dg/lookup/strong-using2.C: New test.
+
 2019-05-20  Jeff Law  <law@redhat.com>
 
        * gcc.dg/Wtype-limits-Wextra.c: Adjust expected output after
diff --git a/gcc/testsuite/g++.dg/lookup/strong-using2.C b/gcc/testsuite/g++.dg/lookup/strong-using2.C
new file mode 100644 (file)
index 0000000..1728494
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-w" }
+
+namespace A
+{
+  namespace B // { dg-bogus "inline namespace" }
+  {
+  }
+
+  using namespace B __attribute__ ((strong)); // { dg-bogus "no longer supported" }
+}