public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36566]  New: Cannot bind packed field
@ 2008-06-18 18:28 nevin at eviloverlord dot com
  2008-06-18 18:31 ` [Bug c++/36566] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: nevin at eviloverlord dot com @ 2008-06-18 18:28 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

If I have a packed struct and try to pass a member variable by reference to a
function call, I get the "error: cannot bind packed field" message.  If I
explicitly create a reference to the member variable first and pass that,
things work fine.  One of these behaviors must be incorrect.

This issue also exists under gcc 4.0.1 (same host/target/build triplet as
above) and gcc 4.1.2 under Linux.  Under gcc 3.3.3 (on Linux), there was no
error.

Here is code which demonstrates the issue:

struct Squeeze
{
    short   s;
} __attribute__((aligned(1), packed));

void VerticallyChallenged(short&) {}

int main()
{
    Squeeze oj;
    short& pit(oj.s);

    VerticallyChallenged(pit);  // okay
    VerticallyChallenged(oj.s); // cannot bind packed field ‘oj.Squeeze::s’ to
‘short int&’
}


-- 
           Summary: Cannot bind packed field
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nevin at eviloverlord dot com
 GCC build triplet: i686-apple-darwin9
  GCC host triplet: i686-apple-darwin9
GCC target triplet: i686-apple-darwin9


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <bug-36566-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-12-31 15:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-18 18:28 [Bug c++/36566] New: Cannot bind packed field nevin at eviloverlord dot com
2008-06-18 18:31 ` [Bug c++/36566] " pinskia at gcc dot gnu dot org
2008-06-18 18:49 ` nevin at eviloverlord dot com
2008-06-18 19:06 ` nevin at eviloverlord dot com
2009-10-11  4:38 ` gabriel at teuton dot org
     [not found] <bug-36566-4@http.gcc.gnu.org/bugzilla/>
2013-09-13  4:14 ` structurechart at yahoo dot com
2013-09-14 23:08 ` gabriel at teuton dot org
2015-03-18  0:53 ` xiaoj at google dot com
2015-03-18  1:56 ` redi at gcc dot gnu.org
2021-12-31 15:11 ` steve+gcc at tecwec dot eu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).