From: Jason Merrill Date: Thu, 30 Nov 2017 17:43:08 +0000 (-0500) Subject: PR c++/82219 - bogus -Wignored-qualifiers with template X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d11897a77255a521a6c420739266d3bec0c76fe;p=gcc.git PR c++/82219 - bogus -Wignored-qualifiers with template * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress -Wignored-qualifiers. From-SVN: r255279 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e6851d34318..bb0e2bbb7bf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-11-30 Jason Merrill + + 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 * parser.c (cp_parser_unary_expression): Generate a location for diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7e2f7740106..500ac0c64fe 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..5be61a6f394 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wignored-qualifiers1.C @@ -0,0 +1,8 @@ +// PR c++/82219 +// { dg-additional-options "-Wall -Wextra" } + +struct A { + template T foo(T *) const { return static_cast(0); } + void bar() const { foo(&i); } + int i; +};