diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97bcb235778..98d9fdbdc67 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -5,6 +5,11 @@ 2003-04-29 Mark Mitchell + PR c++/10515 + * cp-tree.h (lookup_field_1): Declare it. + * search.c (lookup_field_1): Make it public. + * decl.c (reshape_init): Handle designated initializers. + * decl.c (maybe_commonize_var): Further tweak support for systems without weak symbols. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 9db905cf459..73e07667682 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4014,6 +4014,7 @@ extern int types_overlap_p (tree, tree); extern tree get_vbase (tree, tree); extern tree get_dynamic_cast_base_type (tree, tree); extern int accessible_p (tree, tree); +extern tree lookup_field_1 (tree, tree, bool); extern tree lookup_field (tree, tree, int, bool); extern int lookup_fnfields_1 (tree, tree); extern tree lookup_fnfields (tree, tree, int); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index b557fdfc265..fa274353df0 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -81,7 +81,6 @@ struct vbase_info tree inits; }; -static tree lookup_field_1 (tree, tree, bool); static tree dfs_check_overlap (tree, void *); static tree dfs_no_overlap_yet (tree, int, void *); static base_kind lookup_base_r (tree, tree, base_access, @@ -430,7 +429,7 @@ get_dynamic_cast_base_type (tree subtype, tree target) figure out whether it can access this field. (Since it is only one level, this is reasonable.) */ -static tree +tree lookup_field_1 (tree type, tree name, bool want_type) { register tree field; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d12532817f1..45326b207d3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-04-29 Mark Mitchell + * g++.dg/ext/desig1.C: New test. + * g++.dg/ext/init1.C: Likewise. + * g++.old-deja/g++.pt/deduct5.C: Remove unnecessary initializer. 2003-04-28 Mark Mitchell diff --git a/gcc/testsuite/g++.dg/ext/desig1.C b/gcc/testsuite/g++.dg/ext/desig1.C new file mode 100644 index 00000000000..c3ff4c14258 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/desig1.C @@ -0,0 +1,24 @@ +// { dg-options "" } + +struct a { + int x; +}; + +struct b { + int x; + int y; +}; + +struct foo { + union { + struct a a; + struct b b; + } u; +}; + +int main(void) +{ + struct foo bar = { u: { b: { x: 0, y: 0, }}}; + (void)bar; + return 0; +} diff --git a/gcc/testsuite/g++.dg/ext/init1.C b/gcc/testsuite/g++.dg/ext/init1.C index c90e2c9cc12..f8d8e8533e4 100644 --- a/gcc/testsuite/g++.dg/ext/init1.C +++ b/gcc/testsuite/g++.dg/ext/init1.C @@ -1,5 +1,6 @@ // PR c++/9623 // Test for trivial use of named initializer extension +// { dg-options "" } struct S { int x; int y; }; S s = { x:1, y:2 };