Bug 222478 - cannot reference a r-value
Summary: cannot reference a r-value
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-13 00:33 UTC by tropikhajma
Modified: 2010-01-14 05:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
patch (379 bytes, patch)
2010-01-13 00:34 UTC, tropikhajma
Details
real patch (611 bytes, patch)
2010-01-13 11:46 UTC, tropikhajma
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tropikhajma 2010-01-13 00:33:32 UTC
Version:           4.3.90 (using Devel)
Compiler:          Suun Studio 12 U1 
OS:                Solaris
Installed from:    Compiled sources

building kdenetwork 4.3.90 with Sun Studio 12u1 on opensolaris fails with:
...
"/home/test/packages/BUILD/kdenetwork-4.3.90/kopete/kopete/chatwindow/chatmessagepart.cpp", line 1433: Warning: cannot take address of a temporary.
"/home/test/packages/BUILD/kdenetwork-4.3.90/kopete/kopete/chatwindow/chatmessagepart.cpp", line 1433: Error: The "&" operator can only be applied to a variable or other l-value.

the compiler is right, see the C++ standard:
"The result of the unary & operator is a pointer to its operand. The operand shall be an lvalue [...]" (5.3.1/2) and "The result of calling a function that does not return a reference is an rvalue" (3.10/5)."


the attached patch helped me move on
Comment 1 tropikhajma 2010-01-13 00:34:42 UTC
Created attachment 39826 [details]
patch
Comment 2 Roman Jarosz 2010-01-13 09:16:56 UTC
Is this really the right patch?
Comment 3 tropikhajma 2010-01-13 11:46:32 UTC
Created attachment 39837 [details]
real patch
Comment 4 tropikhajma 2010-01-13 11:46:53 UTC
Comment on attachment 39826 [details]
patch

sorry
Comment 5 Matt Rogers 2010-01-14 05:40:11 UTC
SVN commit 1074424 by mattr:

Compile on Sun Studio 12u1

Taking the address of an r-value is not allowed on that compiler.

Thanks for the patch!

BUG: 222478

 M  +2 -1      chatmessagepart.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1074424
Comment 6 Matt Rogers 2010-01-14 05:43:49 UTC
SVN commit 1074425 by mattr:

Compile on Sun Studio 12u1

Taking the address of an r-value is not allowed on that compiler.

Thanks for the patch!

CCBUG: 222478

Forwardported from the 4.4 branch

 M  +2 -1      chatmessagepart.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1074425