This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 2.95 bug: template invalidates code
On Aug 20, 1999, "Martin v. Loewis" <martin@mira.isdn.cs.tu-berlin.de> wrote:
>> b11.cc:18: attempt to take address of bit-field structure member `X::t'
> Thanks for your bug report. I believe this diagnosis is correct. The
> compiler detects that bool operator!=<T>(const T& x, const T& y); is a
> candidate for the call to !=. It turns out to be a better candidate
> than anything else, so it is selected by overload resolution. However,
> it is ill-formed to pass a bitfield by reference, hence the error.
It is my understanding that it would only be an error if the reference
was to a non-const type. Since it is `const T&', a temporary should
be created [dcl.init.ref]/10.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them