On Fri, 23 Sep 2011 16:35:59 -0400, so <[email protected]> wrote:
On Fri, 23 Sep 2011 23:27:02 +0300, Jonathan M Davis
<[email protected]> wrote:
On Friday, September 23, 2011 23:19:15 so wrote:
Hello everyone.
I asked this a few times with no response.
Could anyone explain me what is the rational behind this?
Why it won't distinguish mutable overload from immutable as in C++?
That compiles fine with the lastest dmd from git. Is it not compiling
with the
latest release (dmd 2.055)?
- Jonathan M Davis
It compiles fine but the result troubling, wouldn't you expect:
fun
fun const
as a result? This is how it works in C++.
steves@steve-laptop:~/testd$ cat testconst.cpp
#include <iostream>
using namespace std;
struct S {
S& fun() {
cout << "fun" << endl;
return *this;
}
S fun() const {
cout << "fun const" << endl;
return S();
}
};
int main() {
S a;
a.fun() = a.fun();
return 0;
}
steves@steve-laptop:~/testd$ g++ -o testconst testconst.cpp
steves@steve-laptop:~/testd$ ./testconst
fun
fun
steves@steve-laptop:~/testd$
Seems, um to be the same, no?
-Steve