all_prefix_attributes))
YYERROR1;
}
- old_style_parm_decls
- { store_parm_decls (); }
- save_filename save_lineno compstmt_or_error
- { DECL_SOURCE_FILE (current_function_decl) = $7;
- DECL_SOURCE_LINE (current_function_decl) = $8;
- finish_function (0, 1);
+ old_style_parm_decls save_filename save_lineno
+ { DECL_SOURCE_FILE (current_function_decl) = $6;
+ DECL_SOURCE_LINE (current_function_decl) = $7;
+ store_parm_decls (); }
+ compstmt_or_error
+ { finish_function (0, 1);
POP_DECLSPEC_STACK; }
| declspecs_ts setspecs declarator error
{ POP_DECLSPEC_STACK; }
all_prefix_attributes))
YYERROR1;
}
- old_style_parm_decls
- { store_parm_decls (); }
- save_filename save_lineno compstmt_or_error
- { DECL_SOURCE_FILE (current_function_decl) = $7;
- DECL_SOURCE_LINE (current_function_decl) = $8;
- finish_function (0, 1);
+ old_style_parm_decls save_filename save_lineno
+ { DECL_SOURCE_FILE (current_function_decl) = $6;
+ DECL_SOURCE_LINE (current_function_decl) = $7;
+ store_parm_decls (); }
+ compstmt_or_error
+ { finish_function (0, 1);
POP_DECLSPEC_STACK; }
| declspecs_nots setspecs notype_declarator error
{ POP_DECLSPEC_STACK; }
all_prefix_attributes))
YYERROR1;
}
- old_style_parm_decls
- { store_parm_decls (); }
- save_filename save_lineno compstmt_or_error
- { DECL_SOURCE_FILE (current_function_decl) = $6;
- DECL_SOURCE_LINE (current_function_decl) = $7;
- finish_function (0, 1);
+ old_style_parm_decls save_filename save_lineno
+ { DECL_SOURCE_FILE (current_function_decl) = $5;
+ DECL_SOURCE_LINE (current_function_decl) = $6;
+ store_parm_decls (); }
+ compstmt_or_error
+ { finish_function (0, 1);
POP_DECLSPEC_STACK; }
| setspecs notype_declarator error
{ POP_DECLSPEC_STACK; }
}
parsing_iso_function_signature = false; /* Don't warn about nested functions. */
}
- old_style_parm_decls
- { store_parm_decls (); }
+ old_style_parm_decls save_filename save_lineno
+ { tree decl = current_function_decl;
+ DECL_SOURCE_FILE (decl) = $4;
+ DECL_SOURCE_LINE (decl) = $5;
+ store_parm_decls (); }
/* This used to use compstmt_or_error.
That caused a bug with input `f(g) int g {}',
where the use of YYERROR1 above caused an error
which then was handled by compstmt_or_error.
There followed a repeated execution of that same rule,
which called YYERROR1 again, and so on. */
- save_filename save_lineno compstmt
+ compstmt
{ tree decl = current_function_decl;
- DECL_SOURCE_FILE (decl) = $5;
- DECL_SOURCE_LINE (decl) = $6;
finish_function (1, 1);
pop_function_context ();
add_decl_stmt (decl); }
}
parsing_iso_function_signature = false; /* Don't warn about nested functions. */
}
- old_style_parm_decls
- { store_parm_decls (); }
+ old_style_parm_decls save_filename save_lineno
+ { tree decl = current_function_decl;
+ DECL_SOURCE_FILE (decl) = $4;
+ DECL_SOURCE_LINE (decl) = $5;
+ store_parm_decls (); }
/* This used to use compstmt_or_error.
That caused a bug with input `f(g) int g {}',
where the use of YYERROR1 above caused an error
which then was handled by compstmt_or_error.
There followed a repeated execution of that same rule,
which called YYERROR1 again, and so on. */
- save_filename save_lineno compstmt
+ compstmt
{ tree decl = current_function_decl;
- DECL_SOURCE_FILE (decl) = $5;
- DECL_SOURCE_LINE (decl) = $6;
finish_function (1, 1);
pop_function_context ();
add_decl_stmt (decl); }
}
else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{
- duplicate_decls (spec, fn);
+ if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
+ /* Dup decl failed, but this is a new
+ definition. Set the line number so any errors
+ match this new definition. */
+ DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
+
return fn;
}
}
{
SET_DECL_TEMPLATE_SPECIALIZATION (tmpl);
DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
+ if (have_def)
+ {
+ DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
+ DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
+ = DECL_SOURCE_LOCATION (decl);
+ }
return tmpl;
}