* C++ PATCH for c++/82219, -Wignored-qualifiers and template
@ 2017-11-30 17:55 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2017-11-30 17:55 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 128 bytes --]
Many warnings don't make as much sense in template instantiations, this is one.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 82219.diff --]
[-- Type: text/plain, Size: 1101 bytes --]
commit 0b86d1edf07a3abea46c1bdf9a019141a83759b4
Author: Jason Merrill <jason@redhat.com>
Date: Thu Nov 30 11:56:37 2017 -0500
PR c++/82219 - bogus -Wignored-qualifiers with template
* pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress
-Wignored-qualifiers.
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 <typename T> T foo(T *) const { return static_cast<T>(0); }
+ void bar() const { foo(&i); }
+ int i;
+};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-30 17:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-30 17:55 C++ PATCH for c++/82219, -Wignored-qualifiers and template Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).