[Bug c++/57644] New: [C++1y] Cannot bind bitfield to lvalue reference

lucdanton at free dot fr gcc-bugzilla@gcc.gnu.org
Wed Jun 19 05:03:00 GMT 2013


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

            Bug ID: 57644
           Summary: [C++1y] Cannot bind bitfield to lvalue reference
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr

$ g++-snapshot --version
g++-snapshot (Debian 20130603-1) 4.9.0 20130603 (experimental) [trunk revision
199603]

$ cat main.cpp 
struct foo {
    unsigned i: 32;
};

int main()
{
    foo f {};
    return (f.i);
}

$ g++-snapshot -std=c++1y main.cpp 
main.cpp: In function 'int main()':
main.cpp:8:15: error: cannot bind bitfield 'f.foo::i' to 'unsigned int&'
     return (f.i);
               ^

-----------

The code is accepted if either the parens are removed (i.e. just return f.i;)
or when using -std=c++11.



More information about the Gcc-bugs mailing list