PR c++/80544 strip cv-quals from cast results
authorJonathan Wakely <jwakely@redhat.com>
Wed, 24 May 2017 22:16:59 +0000 (23:16 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 24 May 2017 22:16:59 +0000 (23:16 +0100)
commitd4a760d8c43fa10aa5b450b66f2f4bf67f898a8c
tree0b9e9d9dadfb3945f1b82de004c3c56971bdf0ed
parent3cd211af9989ca33f08c9d9d7c29ba7cb208b645
PR c++/80544 strip cv-quals from cast results

gcc/cp:

PR c++/80544
* tree.c (reshape_init): Use unqualified type for direct enum init.
* typeck.c (maybe_warn_about_cast_ignoring_quals): New.
(build_static_cast_1, build_reinterpret_cast_1): Strip cv-quals from
non-class destination types.
(build_const_cast_1): Strip cv-quals from destination types.
(build_static_cast, build_reinterpret_cast, build_const_cast)
(cp_build_c_cast): Add calls to maybe_warn_about_cast_ignoring_quals.

gcc/testsuite:

PR c++/80544
* g++.dg/expr/cast11.C: New test.

From-SVN: r248432
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/cast11.C [new file with mode: 0644]