+2018-11-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * parser.c (make_id_declarator): Add location_t parameter.
+ (cp_parser_lambda_declarator_opt): Adjust call.
+ (cp_parser_decomposition_declaration): Likewise.
+ (cp_parser_alias_declaration): Likewise.
+ (cp_parser_direct_declarator): Likewise.
+ (cp_parser_member_declaration): Likewise.
+ (cp_parser_objc_class_ivars): Likewise.
+ * decl.c (grokdeclarator): Use declarator->id_loc in two error
+ messages.
+
2018-11-14 Jakub Jelinek <jakub@redhat.com>
P1236R1 - Signed integers are two's complement
{
if (unqualified_id)
{
- error ("field %qD has incomplete type %qT",
- unqualified_id, type);
+ error_at (declarator->id_loc,
+ "field %qD has incomplete type %qT",
+ unqualified_id, type);
cxx_incomplete_type_inform (strip_array_types (type));
}
else
{
if (friendp)
{
- error ("%qE is neither function nor member function; "
- "cannot be declared friend", unqualified_id);
+ error_at (declarator->id_loc,
+ "%qE is neither function nor member function; "
+ "cannot be declared friend", unqualified_id);
return error_mark_node;
}
decl = NULL_TREE;
static cp_declarator *
make_id_declarator (tree qualifying_scope, tree unqualified_name,
- special_function_kind sfk)
+ special_function_kind sfk, location_t id_location)
{
cp_declarator *declarator;
declarator->u.id.qualifying_scope = qualifying_scope;
declarator->u.id.unqualified_name = unqualified_name;
declarator->u.id.sfk = sfk;
-
+ declarator->id_loc = id_location;
+
return declarator;
}
p = obstack_alloc (&declarator_obstack, 0);
- declarator = make_id_declarator (NULL_TREE, call_op_identifier, sfk_none);
+ declarator = make_id_declarator (NULL_TREE, call_op_identifier, sfk_none,
+ LAMBDA_EXPR_LOCATION (lambda_expr));
quals = (LAMBDA_EXPR_MUTABLE_P (lambda_expr)
? TYPE_UNQUALIFIED : TYPE_QUAL_CONST);
exception_spec,
return_type,
/*requires_clause*/NULL_TREE);
- declarator->id_loc = LAMBDA_EXPR_LOCATION (lambda_expr);
declarator->std_attributes = attributes;
fco = grokmethod (&return_type_specs,
FOR_EACH_VEC_ELT (v, i, e)
{
if (i == 0)
- declarator = make_id_declarator (NULL_TREE, e.get_value (), sfk_none);
+ declarator = make_id_declarator (NULL_TREE, e.get_value (),
+ sfk_none, e.get_location ());
else
- declarator->u.id.unqualified_name = e.get_value ();
- declarator->id_loc = e.get_location ();
+ {
+ declarator->u.id.unqualified_name = e.get_value ();
+ declarator->id_loc = e.get_location ();
+ }
tree elt_pushed_scope;
tree decl2 = start_decl (declarator, &decl_specs, SD_INITIALIZED,
NULL_TREE, NULL_TREE, &elt_pushed_scope);
/*declarator=*/NULL))
return error_mark_node;
- declarator = make_id_declarator (NULL_TREE, id, sfk_none);
- declarator->id_loc = id_location;
+ declarator = make_id_declarator (NULL_TREE, id, sfk_none, id_location);
member_p = at_class_scope_p ();
if (member_p)
}
declarator = make_id_declarator (qualifying_scope,
unqualified_name,
- sfk);
+ sfk, token->location);
declarator->std_attributes = attrs;
- declarator->id_loc = token->location;
declarator->parameter_pack_p = pack_expansion_p;
if (pack_expansion_p)
tree identifier;
tree width;
tree late_attributes = NULL_TREE;
+ location_t id_location
+ = cp_lexer_peek_token (parser->lexer)->location;
if (named_bitfld)
identifier = cp_parser_identifier (parser);
decl = grokbitfield (identifier
? make_id_declarator (NULL_TREE,
identifier,
- sfk_none)
+ sfk_none,
+ id_location)
: NULL,
&decl_specifiers,
width, initializer,
/* Get the name of the bitfield. */
declarator = make_id_declarator (NULL_TREE,
cp_parser_identifier (parser),
- sfk_none);
+ sfk_none, token->location);
eat_colon:
cp_lexer_consume_token (parser->lexer); /* Eat ':'. */
union U // { dg-message "not complete" }
{
- U u[1] = { 0 }; // { dg-error "incomplete type" }
+ U u[1] = { 0 }; // { dg-error "5:field .u. has incomplete type" }
};
template<typename T>
union UF
{
- F u[1] = { 0 }; // { dg-error "incomplete type" }
+ F u[1] = { 0 }; // { dg-error "5:field .u. has incomplete type" }
};
template<typename T>
union UFT
{
- F u[1] = { 0 }; // { dg-error "incomplete type" }
+ F u[1] = { 0 }; // { dg-error "5:field .u. has incomplete type" }
};
template union UFT<int>;
struct S // { dg-message "not complete" }
{
- S s[1] = { 0 }; // { dg-error "incomplete type" }
+ S s[1] = { 0 }; // { dg-error "5:field .s. has incomplete type" }
};
template<typename T>
struct SF
{
- F s[1] = { 0 }; // { dg-error "incomplete type" }
+ F s[1] = { 0 }; // { dg-error "5:field .s. has incomplete type" }
};
template<typename T>
struct SFT
{
- F s[1] = { 0 }; // { dg-error "incomplete type" }
+ F s[1] = { 0 }; // { dg-error "5:field .s. has incomplete type" }
};
template class SFT<int>;