aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-01-19 23:35:09 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-01-19 23:35:09 +0100
commite6f97c3feec266355a80cdcb68a5885748454c39 (patch)
tree20d26cc1b01d13bb50dade94d916dbfbaf442738
parentef61d1ab18889896fd1487ec5222e10a68a0e58d (diff)
downloadgcc-e6f97c3feec266355a80cdcb68a5885748454c39.zip
gcc-e6f97c3feec266355a80cdcb68a5885748454c39.tar.gz
gcc-e6f97c3feec266355a80cdcb68a5885748454c39.tar.bz2
re PR c++/83919 (spurious -Wignored-qualifiers warning)
PR c++/83919 * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers for direct enum init. * decl.c (reshape_init): Likewise. * g++.dg/cpp0x/pr83919.C: New test. From-SVN: r256903
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/cp/typeck.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr83919.C10
5 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3e40d79..eb39b40 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83919
+ * typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
+ for direct enum init.
+ * decl.c (reshape_init): Likewise.
+
2018-01-19 Marek Polacek <polacek@redhat.com>
* constexpr.c (fold_simple): Simplify.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 32ac81f..039ddd9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6091,6 +6091,7 @@ reshape_init (tree type, tree init, tsubst_flags_t complain)
if (check_narrowing (ENUM_UNDERLYING_TYPE (type), elt, complain))
{
warning_sentinel w (warn_useless_cast);
+ warning_sentinel w2 (warn_ignored_qualifiers);
return cp_build_c_cast (type, elt, tf_warning_or_error);
}
else
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d0adb79..1102f67 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8689,6 +8689,7 @@ convert_for_assignment (tree type, tree rhs,
if (check_narrowing (ENUM_UNDERLYING_TYPE (type), elt, complain))
{
warning_sentinel w (warn_useless_cast);
+ warning_sentinel w2 (warn_ignored_qualifiers);
rhs = cp_build_c_cast (type, elt, complain);
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2d0e317..d6ea61f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83919
+ * g++.dg/cpp0x/pr83919.C: New test.
+
2018-01-19 Jeff Law <law@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83919.C b/gcc/testsuite/g++.dg/cpp0x/pr83919.C
new file mode 100644
index 0000000..a612f02
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr83919.C
@@ -0,0 +1,10 @@
+// PR c++/83919
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wignored-qualifiers" }
+
+enum class Conf;
+struct foo
+{
+ foo (const Conf& conf) : x{conf} {} // { dg-bogus "type qualifiers ignored on cast result type" }
+ const Conf x;
+};