mirror of git://gcc.gnu.org/git/gcc.git
redef2.C: New.
testsuite/ * g++.dg/parse/redef2.C: New. cp/ * parser.c (make_pointer_declarator, make_reference_declarator, make_call_declarator, make_array_declarator): Set declarator->id_loc. (cp_parser_init_declarator): Adjust location of decl if appropriate. From-SVN: r163920
This commit is contained in:
parent
c18605ccec
commit
6f295bbf76
|
@ -1,3 +1,9 @@
|
||||||
|
2010-09-06 Arnaud Charlet <charlet@adacore.com>
|
||||||
|
|
||||||
|
* parser.c (make_pointer_declarator, make_reference_declarator,
|
||||||
|
make_call_declarator, make_array_declarator): Set declarator->id_loc.
|
||||||
|
(cp_parser_init_declarator): Adjust location of decl if appropriate.
|
||||||
|
|
||||||
2010-09-06 Jason Merrill <jason@redhat.com>
|
2010-09-06 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
* call.c (implicit_conversion): Fix value-init of enums.
|
* call.c (implicit_conversion): Fix value-init of enums.
|
||||||
|
|
|
@ -1068,6 +1068,7 @@ make_pointer_declarator (cp_cv_quals cv_qualifiers, cp_declarator *target)
|
||||||
declarator->u.pointer.class_type = NULL_TREE;
|
declarator->u.pointer.class_type = NULL_TREE;
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
declarator->id_loc = target->id_loc;
|
||||||
declarator->parameter_pack_p = target->parameter_pack_p;
|
declarator->parameter_pack_p = target->parameter_pack_p;
|
||||||
target->parameter_pack_p = false;
|
target->parameter_pack_p = false;
|
||||||
}
|
}
|
||||||
|
@ -1091,6 +1092,7 @@ make_reference_declarator (cp_cv_quals cv_qualifiers, cp_declarator *target,
|
||||||
declarator->u.reference.rvalue_ref = rvalue_ref;
|
declarator->u.reference.rvalue_ref = rvalue_ref;
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
declarator->id_loc = target->id_loc;
|
||||||
declarator->parameter_pack_p = target->parameter_pack_p;
|
declarator->parameter_pack_p = target->parameter_pack_p;
|
||||||
target->parameter_pack_p = false;
|
target->parameter_pack_p = false;
|
||||||
}
|
}
|
||||||
|
@ -1147,6 +1149,7 @@ make_call_declarator (cp_declarator *target,
|
||||||
declarator->u.function.late_return_type = late_return_type;
|
declarator->u.function.late_return_type = late_return_type;
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
declarator->id_loc = target->id_loc;
|
||||||
declarator->parameter_pack_p = target->parameter_pack_p;
|
declarator->parameter_pack_p = target->parameter_pack_p;
|
||||||
target->parameter_pack_p = false;
|
target->parameter_pack_p = false;
|
||||||
}
|
}
|
||||||
|
@ -1169,6 +1172,7 @@ make_array_declarator (cp_declarator *element, tree bounds)
|
||||||
declarator->u.array.bounds = bounds;
|
declarator->u.array.bounds = bounds;
|
||||||
if (element)
|
if (element)
|
||||||
{
|
{
|
||||||
|
declarator->id_loc = element->id_loc;
|
||||||
declarator->parameter_pack_p = element->parameter_pack_p;
|
declarator->parameter_pack_p = element->parameter_pack_p;
|
||||||
element->parameter_pack_p = false;
|
element->parameter_pack_p = false;
|
||||||
}
|
}
|
||||||
|
@ -14010,6 +14014,13 @@ cp_parser_init_declarator (cp_parser* parser,
|
||||||
decl = start_decl (declarator, decl_specifiers,
|
decl = start_decl (declarator, decl_specifiers,
|
||||||
is_initialized, attributes, prefix_attributes,
|
is_initialized, attributes, prefix_attributes,
|
||||||
&pushed_scope);
|
&pushed_scope);
|
||||||
|
/* Adjust location of decl if declarator->id_loc is more appropriate:
|
||||||
|
set, and decl wasn't merged with another decl, in which case its
|
||||||
|
location would be different from input_location, and more accurate. */
|
||||||
|
if (DECL_P (decl)
|
||||||
|
&& declarator->id_loc != UNKNOWN_LOCATION
|
||||||
|
&& DECL_SOURCE_LOCATION (decl) == input_location)
|
||||||
|
DECL_SOURCE_LOCATION (decl) = declarator->id_loc;
|
||||||
}
|
}
|
||||||
else if (scope)
|
else if (scope)
|
||||||
/* Enter the SCOPE. That way unqualified names appearing in the
|
/* Enter the SCOPE. That way unqualified names appearing in the
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2010-09-06 Arnaud Charlet <charlet@adacore.com>
|
||||||
|
|
||||||
|
* g++.dg/parse/redef2.C: New.
|
||||||
|
|
||||||
2010-09-06 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
2010-09-06 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||||
|
|
||||||
* gcc.dg/20100906-1.c: New testcase.
|
* gcc.dg/20100906-1.c: New testcase.
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// { dg-do assemble }
|
||||||
|
|
||||||
|
char * d [10]; // { dg-error "8: 'd' has a previous declaration as" }
|
||||||
|
char e [15][10];
|
||||||
|
int (*f)();
|
||||||
|
|
||||||
|
int d; // { dg-error "" }
|
Loading…
Reference in New Issue