diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2012-01-01 20:21:36 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-01-01 20:21:36 +0000 |
commit | 9f88ff5a1fedb4ac29628ec421ff0cc613ba6f38 (patch) | |
tree | be9e78f3b2cbb2cc86058386b500ee89964447eb /gcc/cp | |
parent | b81e8df8386836f92a06bf6b60159a2c703d9b88 (diff) | |
download | gcc-9f88ff5a1fedb4ac29628ec421ff0cc613ba6f38.zip gcc-9f88ff5a1fedb4ac29628ec421ff0cc613ba6f38.tar.gz gcc-9f88ff5a1fedb4ac29628ec421ff0cc613ba6f38.tar.bz2 |
re PR c++/51379 ([C++0x] [DR 799] reinterpret_cast is not particularly useful)
/cp
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51379
* typeck.c (build_reinterpret_cast_1): Implement resolution of
DR 799.
/testsuite
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51379
* g++.dg/conversion/reinterpret4.C: New.
* g++.dg/conversion/reinterpret1.C: Adjust.
From-SVN: r182775
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d2c5de..b4a3df4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,4 +1,10 @@ -2011-12-31 Fabien ChĂȘne <fabien@gcc.gnu.org> +2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51379 + * typeck.c (build_reinterpret_cast_1): Implement resolution of + DR 799. + +2012-01-01 Fabien ChĂȘne <fabien@gcc.gnu.org> * parser.c (cp_parser_using_declaration): Add a warning about deprecated access declarations when no errors were encountered diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b168963..d9166c9 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6203,6 +6203,11 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, else if (TYPE_PTR_P (type) && INTEGRAL_OR_ENUMERATION_TYPE_P (intype)) /* OK */ ; + else if ((INTEGRAL_OR_ENUMERATION_TYPE_P (type) + || TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type)) + && same_type_p (type, intype)) + /* DR 799 */ + return fold_if_not_in_template (build_nop (type, expr)); else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype)) || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))) return fold_if_not_in_template (build_nop (type, expr)); |