]> gcc.gnu.org Git - gcc.git/commitdiff
PR c++/82219 - bogus -Wignored-qualifiers with template
authorJason Merrill <jason@redhat.com>
Thu, 30 Nov 2017 17:43:08 +0000 (12:43 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 30 Nov 2017 17:43:08 +0000 (12:43 -0500)
* pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
-Wignored-qualifiers.

From-SVN: r255279

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/warn/Wignored-qualifiers1.C [new file with mode: 0644]

index e6851d3431895919b7c3f0ada7873264372238e2..bb0e2bbb7bf741e7ff350662b6c4b7b92db11db0 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-30  Jason Merrill  <jason@redhat.com>
+
+       PR c++/82219 - bogus -Wignored-qualifiers with template
+       * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
+       -Wignored-qualifiers.
+
 2017-11-29  David Malcolm  <dmalcolm@redhat.com>
 
        * parser.c (cp_parser_unary_expression): Generate a location for
index 7e2f7740106da15fa07a4469c6504e1e2928c9ea..500ac0c64feebc74f43313197f1f01f7f0a9c09f 100644 (file)
@@ -17180,6 +17180,7 @@ tsubst_copy_and_build (tree t,
        op = RECUR (TREE_OPERAND (t, 0));
 
        warning_sentinel s(warn_useless_cast);
+       warning_sentinel s2(warn_ignored_qualifiers);
        switch (TREE_CODE (t))
          {
          case CAST_EXPR:
diff --git a/gcc/testsuite/g++.dg/warn/Wignored-qualifiers1.C b/gcc/testsuite/g++.dg/warn/Wignored-qualifiers1.C
new file mode 100644 (file)
index 0000000..5be61a6
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/82219
+// { dg-additional-options "-Wall -Wextra" }
+
+struct A {
+  template <typename T> T foo(T *) const { return static_cast<T>(0); }
+  void bar() const { foo(&i); }
+  int i;
+};
This page took 0.132134 seconds and 5 git commands to generate.