Bug 222478

Summary: cannot reference a r-value
Product: [Unmaintained] kopete Reporter: tropikhajma <tropikhajma>
Component: generalAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: tiagosh
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: patch
real patch

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