says of sizeof: "When applied to a reference
or a reference type, the result is the size of
the referenced type." */
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
write_exp_elt_longcst (pstate,
(LONGEST) TYPE_LENGTH (type));
{ insert_type (tp_reference); }
| '&' ptr_operator
{ insert_type (tp_reference); }
+ | ANDAND
+ { insert_type (tp_rvalue_reference); }
+ | ANDAND ptr_operator
+ { insert_type (tp_rvalue_reference); }
;
ptr_operator_ts: ptr_operator
}
/* Insert a new type, TP, at the bottom of the type stack. If TP is
- tp_pointer or tp_reference, it is inserted at the bottom. If TP is
- a qualifier, it is inserted at slot 1 (just above a previous
- tp_pointer) if there is anything on the stack, or simply pushed if
- the stack is empty. Other values for TP are invalid. */
+ tp_pointer, tp_reference or tp_rvalue_reference, it is inserted at the
+ bottom. If TP is a qualifier, it is inserted at slot 1 (just above a
+ previous tp_pointer) if there is anything on the stack, or simply pushed
+ if the stack is empty. Other values for TP are invalid. */
void
insert_type (enum type_pieces tp)
int slot;
gdb_assert (tp == tp_pointer || tp == tp_reference
- || tp == tp_const || tp == tp_volatile);
+ || tp == tp_rvalue_reference || tp == tp_const
+ || tp == tp_volatile);
/* If there is anything on the stack (we know it will be a
tp_pointer), insert the qualifier above it. Otherwise, simply
make_addr_space = 0;
break;
case tp_reference:
- follow_type = lookup_lvalue_reference_type (follow_type);
- if (make_const)
- follow_type = make_cv_type (make_const,
- TYPE_VOLATILE (follow_type),
- follow_type, 0);
- if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
- make_volatile,
- follow_type, 0);
- if (make_addr_space)
- follow_type = make_type_with_address_space (follow_type,
- make_addr_space);
+ follow_type = lookup_lvalue_reference_type (follow_type);
+ goto process_reference;
+ case tp_rvalue_reference:
+ follow_type = lookup_rvalue_reference_type (follow_type);
+ process_reference:
+ if (make_const)
+ follow_type = make_cv_type (make_const,
+ TYPE_VOLATILE (follow_type),
+ follow_type, 0);
+ if (make_volatile)
+ follow_type = make_cv_type (TYPE_CONST (follow_type),
+ make_volatile,
+ follow_type, 0);
+ if (make_addr_space)
+ follow_type = make_type_with_address_space (follow_type,
+ make_addr_space);
make_const = make_volatile = 0;
make_addr_space = 0;
break;