[Issue 10150] Prefix method 'this' qualifiers should be just ignored anytime

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 27 11:26:25 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10150


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-06-27 11:26:24 PDT ---
I disagree with this change, this is extremely dangerous behavior when
interfacing with C. Take a look at the following:

-----
extern(C) const int *foo();

void main()
{
    *foo() = 1;  // compiles
}
-----

The proper definition should have been:

-----
extern(C) const(int)* foo();

void main()
{
    *foo() = 1;  // fails
}
-----

It is very easy to make this mistake, it should not be silent, at least not for
module-scoped functions.

Alternatively as a compromise I suggest we at least add this check for
extern(C) functions, because this is where this problem can occur very
frequently.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list