[Bug c++/43663] Can't take a const-ref to a bit field
james.dennett at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun May 15 12:04:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43663
James Dennett <james.dennett at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |james.dennett at gmail dot
| |com
--- Comment #6 from James Dennett <james.dennett at gmail dot com> 2011-05-15 11:52:01 UTC ---
Here's a quick hack that causes a temporary to be generated when binding a
bit-field to a reference-to-const.
$ svn diff
Index: call.c
===================================================================
--- call.c (revision 173769)
+++ call.c (working copy)
@@ -8594,7 +8594,7 @@
expr = error_mark_node;
else
{
- if (!lvalue_or_rvalue_with_address_p (expr))
+ if (is_bitfield_expr_with_lowered_type (expr) ||
!lvalue_or_rvalue_with_address_p (expr))
{
tree init;
var = set_up_extended_ref_temp (decl, expr, cleanup, &init);
I'll try to make time to clean that up and add regression tests before running
it by someone with stronger gcc-fu.
More information about the Gcc-bugs
mailing list