Commit f893c16e by Jason Merrill Committed by Jason Merrill

re PR c++/3331 (member pointer inherits const)

        * tree.c (build1): Don't set TREE_READONLY on INDIRECT_REF.
        PR c++/3331
        * cp/init.c (resolve_offset_ref): Use build_indirect_ref.

From-SVN: r49132
parent b2115575
2002-01-23 Jason Merrill <jason@redhat.com> 2002-01-23 Jason Merrill <jason@redhat.com>
* tree.c (build1): Don't set TREE_READONLY on INDIRECT_REF.
* function.c (assign_parms): Don't put args of inline functions * function.c (assign_parms): Don't put args of inline functions
into registers when not optimizing. into registers when not optimizing.
......
2002-01-22 Jason Merrill <jason@redhat.com> 2002-01-23 Jason Merrill <jason@redhat.com>
PR c++/3331
* init.c (resolve_offset_ref): Use build_indirect_ref.
* decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'. * decl2.c (grokclassfn): Don't set DECL_REGISTER on 'this'.
2002-01-22 Jason Merrill <jason@redhat.com>
* parse.y (function_body): Suppress the block for the outermost * parse.y (function_body): Suppress the block for the outermost
curly braces. curly braces.
* decl.c (pushdecl): Don't try to skip it. * decl.c (pushdecl): Don't try to skip it.
......
...@@ -1880,9 +1880,8 @@ resolve_offset_ref (exp) ...@@ -1880,9 +1880,8 @@ resolve_offset_ref (exp)
member = cp_convert (ptrdiff_type_node, member); member = cp_convert (ptrdiff_type_node, member);
return build1 (INDIRECT_REF, type, addr = build (PLUS_EXPR, build_pointer_type (type), addr, member);
build (PLUS_EXPR, build_pointer_type (type), return build_indirect_ref (addr, 0);
addr, member));
} }
else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member))) else if (TYPE_PTRMEMFUNC_P (TREE_TYPE (member)))
{ {
......
...@@ -2507,6 +2507,12 @@ build1 (code, type, node) ...@@ -2507,6 +2507,12 @@ build1 (code, type, node)
TREE_READONLY (t) = 0; TREE_READONLY (t) = 0;
break; break;
case INDIRECT_REF:
/* Whether a dereference is readonly has nothing to do with whether
its operand is readonly. */
TREE_READONLY (t) = 0;
break;
default: default:
if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node)) if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node))
TREE_CONSTANT (t) = 1; TREE_CONSTANT (t) = 1;
......
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