Commit e6f97c3f by Jakub Jelinek Committed by Jakub Jelinek

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
parent ef61d1ab
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.
......
......@@ -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
......
......@@ -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
......
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>
......
// 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;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment