This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct


Hi,

On Tue, 23 Feb 2016, H.J. Lu wrote:

> I thought
> 
> ---
> An empty type is a type where it and all of its subobjects (recursively)
> are of class, structure, union, or array type.
> ---
> 
> excluded
> 
> struct empty
> {
> empty () = default;
> };


Why would that be excluded?  There are no subobjects, hence all of them 
are of class, structure, union or array type, hence this is an empty type. 
(And that's good, it indeed looks quite empty to me).  Even if you would 
add a non-trivial copy ctor, making this thing not trivially copyable 
anymore, it would still be empty.  Hence, given your proposed language in 
the psABI, without reference to any other ABI (in particular not to the 
Itanium C++ ABI), you would then need to pass it without registers.  That 
can't be done, and that's exactly why I find that wording incomplete.  It 
needs implicit references to other languages ABIs to work.

> Adding "trivially copyable" extends, not limiting, the scope of
> empty type.

Huh?  Adding (as in ANDing, not ORing) anything to a positive condition 
necessarily restricts it.  But also note, that my wording does _not_ add 
the restriction to the definition of "empty type", but rather only to when 
they can be passed/returned by nothing.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]