mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-14 12:21:08 +08:00
typeck.c (build_modify_expr): Say `initialization' for INIT_EXPRs.
cp: * typeck.c (build_modify_expr): Say `initialization' for INIT_EXPRs. * init.c (build_default_init): Convert to enumeral type, if needed. testsuite: * g++.old-deja/g++.other/init17.C: New test. From-SVN: r39121
This commit is contained in:
parent
2d6dc19dfa
commit
f5ceeec84f
@ -1,3 +1,10 @@
|
||||
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
|
||||
|
@ -232,7 +232,13 @@ build_default_init (type)
|
||||
/* --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;
|
||||
|
@ -5822,7 +5822,7 @@ build_modify_expr (lhs, modifycode, rhs)
|
||||
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))
|
||||
{
|
||||
|
@ -1,3 +1,7 @@
|
||||
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.
|
||||
|
18
gcc/testsuite/g++.old-deja/g++.other/init17.C
Normal file
18
gcc/testsuite/g++.old-deja/g++.other/init17.C
Normal file
@ -0,0 +1,18 @@
|
||||
// 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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user