http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50280
Bug #: 50280 Summary: Incorrect type deduced for T& when passed a const bitfield Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: jyass...@gcc.gnu.org $ cat test.cc struct S { int bf : 3; }; template<class _T1> void make_pair(_T1& __x) {} void foo() { const S s = S(); make_pair(s.bf); } $ g++-4.6 -c test.cc test.cc: In function 'void foo()': test.cc:8:17: error: cannot bind bitfield 's.S::bf' to 'int&' $ clang++ -c test.cc $ It looks like gcc is deducing the parameter type from the base type of the bitfield rather than its type modified by qualifiers on the containing object. This seems related to PR43663, but isn't the same issue because using "const _T1&" in make_pair makes this compile. This showed up when compiling a make_pair(val, bitfield) call in C++0x mode that worked in C++98 mode, but the underlying issue is present in C++98 too.