Re: g++.dg/ext/packed3.C

2005-12-13 Thread Nathan Sidwell
Jan Beulich wrote: I don't think this is the case. The questionable code (from the test case) really is struct Unpacked { int i; }; struct __attribute__ ((packed)) Packed { char c; int i; Unpacked u; }; and the test expects that you cannot bind Packed::u to Unpacked& (error expected), b

Re: g++.dg/ext/packed3.C

2005-12-12 Thread Jan Beulich
>It can be made to work by not packing Baz::m, and that is what g++ does (with a >warning%). Issuing an error in this case I don't think is acceptable -- I know >of users who would complain. If the user explicitly packed Baz::m field, rather >than the containing structure, I would be happy wit

Re: g++.dg/ext/packed3.C

2005-12-12 Thread Mark Mitchell
Nathan Sidwell wrote: > Mark Mitchell wrote: > >> struct Foo { void operator=(Foo const &);}; >> struct Baz __attribute__((packed)) >> { >>char c; >>Foo m; >> } >> >> void Bar (Baz *ptr) >> { >>ptr->m = something; >> } >> >> I'm not sure it can be made to work, without making th

Re: g++.dg/ext/packed3.C

2005-12-12 Thread Nathan Sidwell
Mark Mitchell wrote: struct Foo { void operator=(Foo const &);}; struct Baz __attribute__((packed)) { char c; Foo m; } void Bar (Baz *ptr) { ptr->m = something; } I'm not sure it can be made to work, without making the base class version of Foo::operator= expect unaligned input

Re: g++.dg/ext/packed3.C

2005-12-12 Thread Mark Mitchell
Nathan Sidwell wrote: > Jan Beulich wrote: > >> >> Why? It's broken. You just cannot embed something that requires >> alignment into something that doesn't guarantee alignment, except that >> for built-in types, the compiler can synthesize the necessary splitting, >> but Foo's assignment operator,

Re: g++.dg/ext/packed3.C

2005-12-07 Thread Nathan Sidwell
Jan Beulich wrote: Why? It's broken. You just cannot embed something that requires alignment into something that doesn't guarantee alignment, except that for built-in types, the compiler can synthesize the necessary splitting, but Foo's assignment operator, in your example, may be totally unawa

Re: g++.dg/ext/packed3.C

2005-12-07 Thread Jan Beulich
>>> Nathan Sidwell <[EMAIL PROTECTED]> 07.12.05 17:22:10 >>> >Jan Beulich wrote: > >> And that is precisely the reason why I think binding a reference to the >> whole object or any of its members, when the object itself is a member >> of a packed object, is illegal, hence requiring a diagnostic (un

Re: g++.dg/ext/packed3.C

2005-12-07 Thread Nathan Sidwell
Jan Beulich wrote: And that is precisely the reason why I think binding a reference to the whole object or any of its members, when the object itself is a member of a packed object, is illegal, hence requiring a diagnostic (unless, like for both other cases, the default is to pack structures).

Re: g++.dg/ext/packed3.C

2005-12-07 Thread Jan Beulich
>>> Nathan Sidwell <[EMAIL PROTECTED]> 07.12.05 16:58:11 >>> >Jan Beulich wrote: >> This test contains three invocations of Ref(), but only two of them are >> considered ill. What I'd like to get an explanation for is why the third >> (middle) instance is considered correct. After all, the u member

Re: g++.dg/ext/packed3.C

2005-12-07 Thread Nathan Sidwell
Jan Beulich wrote: This test contains three invocations of Ref(), but only two of them are considered ill. What I'd like to get an explanation for is why the third (middle) instance is considered correct. After all, the u member of Packed is packed, and hence all the members of Unpacked in that c

g++.dg/ext/packed3.C

2005-12-06 Thread Jan Beulich
This test contains three invocations of Ref(), but only two of them are considered ill. What I'd like to get an explanation for is why the third (middle) instance is considered correct. After all, the u member of Packed is packed, and hence all the members of Unpacked in that context are, too. Name