+2001-01-02 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (strip_all_pointer_quals): Also strip quals from
+ pointer-to-member types.
+
+ * Make-lang.in (cp/TAGS): Use --no-globals. Ignore parse.c, and treat
+ parse.y as C.
+
+ * call.c (build_new_method_call): Do evaluate the object parameter
+ when accessing a static member.
+ * typeck.c (build_component_ref): Likewise.
+
2001-01-02 Andreas Jaeger <aj@suse.de>
* decl.c (cp_missing_noreturn_ok_p): New.
2000-12-22 Jason Merrill <jason@redhat.com>
+ * pt.c (more_specialized): Don't optimize len==0.
+ (fn_type_unification): If we're adding the return type, increase len.
+
* typeck.c (build_binary_op): Fix pmf comparison logic.
* call.c (joust): Use DECL_NONSTATIC_MEMBER_FUNCTION_P, not
# Update the tags table.
cp/TAGS: force
cd $(srcdir)/cp ; \
- etags *.c *.h ; \
- echo 'l' | tr 'l' '\f' >> TAGS ; \
- echo 'parse.y,0' >> TAGS ; \
- etags -a ../*.h ../*.c;
+ etags --no-globals -l c `echo *.c | sed 's/parse.c//'` \
+ parse.y *.h ../*.c ../*.h;
.PHONY: cp/TAGS
tree pretty_name;
tree user_args;
tree templates = NULL_TREE;
+ tree call;
int template_only = 0;
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
|| resolves_to_fixed_type_p (instance, 0)))
flags |= LOOKUP_NONVIRTUAL;
- return build_over_call
- (cand,
- TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE ? mem_args : args,
- flags);
+ if (TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE)
+ call = build_over_call (cand, mem_args, flags);
+ else
+ {
+ call = build_over_call (cand, args, flags);
+ /* Do evaluate the object parameter in a call to a static member
+ function. */
+ if (TREE_SIDE_EFFECTS (instance))
+ call = build (COMPOUND_EXPR, TREE_TYPE (call), instance, call);
+ }
+
+ return call;
}
/* Returns non-zero iff standard conversion sequence ICS1 is a proper
mark_used (field);
else
TREE_USED (field) = 1;
+
+ /* Do evaluate the object when accessing a static member. */
+ if (TREE_SIDE_EFFECTS (datum))
+ field = build (COMPOUND_EXPR, TREE_TYPE (field), datum, field);
+
return field;
}
}
{
if (TREE_CODE (type) == POINTER_TYPE)
return build_pointer_type (strip_all_pointer_quals (TREE_TYPE (type)));
+ else if (TREE_CODE (type) == OFFSET_TYPE)
+ return build_offset_type (TYPE_OFFSET_BASETYPE (type),
+ strip_all_pointer_quals (TREE_TYPE (type)));
else
return TYPE_MAIN_VARIANT (type);
}
// Postfix expression must be evaluated even if accessing a static member.
-// execution test - XFAIL *-*-*
struct S
{
--- /dev/null
+// Test that we can add cv-quals in a static cast to a pointer-to-base type.
+
+struct A { int i; };
+struct B : public A {};
+
+int main()
+{
+ int B::* bp = &B::i;
+ const int A::* ap = static_cast<const int A::*>(bp);
+ return ap != bp;
+}
--- /dev/null
+// Test that we properly evaluate the object parameter when accessing static
+// members.
+
+struct A {
+ static void f () {}
+ static int i;
+};
+
+int A::i;
+
+int c = 0;
+
+A g ()
+{
+ ++c;
+ return A();
+}
+
+int main ()
+{
+ g().f();
+ g().i = 42;
+ return (c != 2);
+}