+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (build_modify_expr): Say `initialization' for
+ INIT_EXPRs.
+ * init.c (build_default_init): Convert to enumeral type, if
+ needed.
+
2001-01-18 Jakub Jelinek <jakub@redhat.com>
* parse.y (nomods_initdcl0): Properly set things up for
/* --if T is a reference type, no initialization is performed. */
return NULL_TREE;
else
- init = integer_zero_node;
+ {
+ init = integer_zero_node;
+
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+ /* We must make enumeral types the right type. */
+ init = fold (build1 (NOP_EXPR, type, init));
+ }
init = digest_init (type, init, 0);
return init;
if (modifycode == INIT_EXPR)
{
newrhs = convert_for_initialization (lhs, lhstype, newrhs, LOOKUP_NORMAL,
- "assignment", NULL_TREE, 0);
+ "initialization", NULL_TREE, 0);
if (current_function_decl &&
lhs == DECL_RESULT (current_function_decl))
{
+2001-01-18 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.other/init17.C: New test.
+
2001-01-18 Alexandre Oliva <aoliva@redhat.com>
* gcc.dg/cpp/if-2.c: Adjust for signed wchar_t.
--- /dev/null
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 17 Jan 2001 <nathan@codesourcery.com>
+
+// Bug 1631. Default initialization of enumeral types did not convert to the
+// enumeral type.
+
+enum X { alpha, beta };
+
+void f(void *ptr)
+{
+ X y = X ();
+ X y1 (0); // ERROR - cannot convert
+ X y2 = X (0);
+ X *x = new X ();
+ X *x2 = new X (0); // ERROR - cannot convert
+}