BUG: reference to "const X *const"

M.Pilichowski@bp.com.pl M.Pilichowski@bp.com.pl
Fri Nov 22 05:11:00 GMT 2002


Hello,

  Description of a problem: when you use reference to "const X *const" (for
example reference to "const string *const" -- const pointer to const
string) BUT you reference it to "just" object, without "const" (e.g.
"string") the temporary object should be created. This is not a problem so
far.
  The problem is that if reference is within class the temporary object IS
created but within a function IS NOT created. See attached code -- I tried
to make it as simple as it is possible. The result is that reference and
pointer taken from class differs while from function don't.
  Even it were some rumours on Polish newsgroups about proper behaviour of
reference (and need of creating temporary object), one thing is obvious --
the behaviour in both cases should be the same.

  Now tech info you asked for:

a-c) see attachment

d.1) gcc -v -save-temps -lstd++ ccref.cpp
d.2) ./a.out

e) none

f) see attachment

Attachment consists of files you asked for -- the "output" is output
generated by GCC with option "-v".

  If it isn't a problem please mail me back -- I would like to know if I
send this bug-report in proper way.

Bye

PS. In GCC 2.95.2 in both cases temporary object WAS NOT created /if it
helps.../.

(See attached file: gcc.output.bz2)(See attached file: ccref.ii.bz2)(See
attached file: ccref.s.bz2)(See attached file: ccref.cpp.bz2)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc.output.bz2
Type: application/octet-stream
Size: 839 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021122/eec828e0/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccref.ii.bz2
Type: application/octet-stream
Size: 66339 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021122/eec828e0/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccref.s.bz2
Type: application/octet-stream
Size: 1712 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021122/eec828e0/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccref.cpp.bz2
Type: application/octet-stream
Size: 250 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021122/eec828e0/attachment-0003.obj>


More information about the Gcc-bugs mailing list