class Foo
{
string s;
Foo(const string& s)
{
this.s = s;
}
string get_Str() const
{
return s;
}
}
Foo f("test");
Log(f.Str); // garbage output
Log(f.get_Str()); // correct output
Log is just:
void Log(const string& s)
{
printf("Log: %s\n", s.c_str());
}
When registered as: "void Log(const string&in)" it's fine. When registered as "void Log(const string&inout)" it crashes, or yields strange results. Having parameter specified as const reference or normal reference doesn't change anything.
Tested on r838(our environment) and r941 (test_getset.cpp):
http://pastebin.com/m1F67qy5
I'm not sure what's the difference between calling getter directly (as function, then it returns temporary object we then pass to our function) as opposed to passing it using property syntax. What exactly going on there?