aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2000-01-05 10:10:53 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-01-05 10:10:53 +0000
commitc0d2229e9019c2a06b2a539680b5ad720b5a3760 (patch)
treecac4bc97439c22cafdac74a594c47bca72d5f974
parent5ed75fe4f4789933b8732fba19635ac99ff17c24 (diff)
downloadgcc-c0d2229e9019c2a06b2a539680b5ad720b5a3760.zip
gcc-c0d2229e9019c2a06b2a539680b5ad720b5a3760.tar.gz
gcc-c0d2229e9019c2a06b2a539680b5ad720b5a3760.tar.bz2
typeck.c (build_static_cast): Don't strip target qualifiers when casting from a class.
* typeck.c (build_static_cast): Don't strip target qualifiers when casting from a class. From-SVN: r31236
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c8ff354..0870e94 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2000-01-05 Nathan Sidwell <nathan@acm.org>
+
+ * typeck.c (build_static_cast): Don't strip target qualifiers
+ when casting from a class.
+
2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (warn_hidden): Initialize variable `fndecl'.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 808d702..b9d5cd2 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1,5 +1,5 @@
/* Build expressions with type checking for C++ compiler.
- Copyright (C) 1987, 88, 89, 92-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 92-99, 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@@ -5183,8 +5183,10 @@ build_static_cast (type, expr)
/* FIXME handle casting to array type. */
ok = 0;
- if (can_convert_arg (strip_all_pointer_quals (type),
- strip_all_pointer_quals (intype), expr))
+ if (IS_AGGR_TYPE (intype)
+ ? can_convert_arg (type, intype, expr)
+ : can_convert_arg (strip_all_pointer_quals (type),
+ strip_all_pointer_quals (intype), expr))
ok = 1;
else if (TYPE_PTROB_P (type) && TYPE_PTROB_P (intype))
{