Commit c8fcb331 by Jason Merrill Committed by Jason Merrill

typeck2.c (process_init_constructor): Sorry about non-trivial labeled initializers.

	* typeck2.c (process_init_constructor): Sorry about non-trivial
	labeled initializers.
	* parse.y (initlist): Reenable labeled initializers.

From-SVN: r18121
parent de575009
Thu Feb 19 10:36:48 1998 Jason Merrill <jason@yorick.cygnus.com>
* typeck2.c (process_init_constructor): Sorry about non-trivial
labeled initializers.
* parse.y (initlist): Reenable labeled initializers.
Thu Feb 19 10:15:55 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> Thu Feb 19 10:15:55 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
* pt.c (coerce_template_parms) Add a new parameter, is_tmpl_parm, * pt.c (coerce_template_parms) Add a new parameter, is_tmpl_parm,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2179,20 +2179,13 @@ initlist: ...@@ -2179,20 +2179,13 @@ initlist:
{ $$ = build_tree_list (NULL_TREE, $$); } { $$ = build_tree_list (NULL_TREE, $$); }
| initlist ',' init | initlist ',' init
{ $$ = expr_tree_cons (NULL_TREE, $3, $$); } { $$ = expr_tree_cons (NULL_TREE, $3, $$); }
/* These are for labeled elements, which don't currently work /* These are for labeled elements. */
as documented, or give warning messages when used with
-ansi -pedantic, or match the syntax currently used in the
C front-end. They are therefore disabled.
| '[' expr_no_commas ']' init | '[' expr_no_commas ']' init
{ $$ = build_expr_list ($2, $4); } { $$ = build_expr_list ($2, $4); }
| initlist ',' CASE expr_no_commas ':' init
{ $$ = expr_tree_cons ($4, $6, $$); }
| identifier ':' init | identifier ':' init
{ $$ = build_expr_list ($$, $3); } { $$ = build_expr_list ($$, $3); }
| initlist ',' identifier ':' init | initlist ',' identifier ':' init
{ $$ = expr_tree_cons ($3, $5, $$); } { $$ = expr_tree_cons ($3, $5, $$); }
*/
; ;
fn.defpen: fn.defpen:
......
...@@ -962,6 +962,9 @@ process_init_constructor (type, init, elts) ...@@ -962,6 +962,9 @@ process_init_constructor (type, init, elts)
{ {
register tree next1; register tree next1;
if (TREE_PURPOSE (tail))
sorry ("non-trivial labeled initializers");
if (TREE_VALUE (tail) != 0) if (TREE_VALUE (tail) != 0)
{ {
tree tail1 = tail; tree tail1 = tail;
...@@ -1038,6 +1041,10 @@ process_init_constructor (type, init, elts) ...@@ -1038,6 +1041,10 @@ process_init_constructor (type, init, elts)
if (TREE_CODE (field) != FIELD_DECL) if (TREE_CODE (field) != FIELD_DECL)
continue; continue;
if (TREE_PURPOSE (tail)
&& TREE_PURPOSE (tail) != DECL_NAME (field))
sorry ("non-trivial labeled initializers");
if (TREE_VALUE (tail) != 0) if (TREE_VALUE (tail) != 0)
{ {
tree tail1 = tail; tree tail1 = tail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment