Home » Developing U++ » U++ Developers corner » How to fix this strong behaviore of MSC compiler & temporary value ?
How to fix this strong behaviore of MSC compiler & temporary value ? [message #44615] |
Fri, 24 April 2015 12:56  |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
Hello:
the code below does not work as expected when compiled with MSC compiler, tested with MSC10/WinXP and MSC12/Win7:
#include <Core/Core.h>
using namespace Upp;
class A
{
public:
int x;
A():x(0) {}
A( A rval_ a) { LOG("from A");x = a.x;}
A(String const &s) { LOG("from String");}
operator String() { LOG("to String"); return ""; }
};
A GetA()
{
A a;
a.x = 6;
return a;
}
CONSOLE_APP_MAIN
{
A a = GetA();
DUMP(a.x);
}
the output of this test case is :
from A
to String
from String
a.x = 1310556
regards
omari.
[Updated on: Fri, 24 April 2015 13:24] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Mon Apr 21 17:10:36 CEST 2025
Total time taken to generate the page: 0.03327 seconds
|