2000-12-15 Jason Merrill <jason@redhat.com>
+ * init.c (build_new_1): Don't strip quals from type.
+
* decl.c (pushdecl): Don't check for linkage on a non-decl.
* call.c (build_op_delete_call): See through ARRAY_TYPEs.
code = has_array ? VEC_NEW_EXPR : NEW_EXPR;
- if (CP_TYPE_QUALS (type))
- type = TYPE_MAIN_VARIANT (type);
-
/* If our base type is an array, then make sure we know how many elements
it has. */
while (TREE_CODE (true_type) == ARRAY_TYPE)
--- /dev/null
+// Test that const-correctness is observed when using new.
+
+struct A {
+ A() { }
+ int f () { return 1; }
+ int f () const { return 0; }
+};
+
+int main ()
+{
+ return (new const A)->f ();
+}