www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4867] New: Postblit is not usable with const objects

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4867

           Summary: Postblit is not usable with const objects
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: samukha voliacable.com



PDT ---
struct S
{
    this(this)
    {
    }
}

void foo(ref const S s)
{
    auto s2 = s;
}

void main()
{  
}

Error: function test.S.__cpctor (ref S p) is not callable using argument types
(const(S)) const

It is not specified how postblit is supposed to interoperate with
const/immutable. Tagging the postblit function with 'const' doesn't help
(compilation fails with the same error).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 14 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4867


Cristi Cobzarenco <cristi.cobzarenco gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cristi.cobzarenco gmail.com



12:55:15 PDT ---

 struct S
 {
     this(this)
     {
     }
 }
 
 void foo(ref const S s)
 {
     auto s2 = s;
 }
 
 void main()
 {  
 }
 
 Error: function test.S.__cpctor (ref S p) is not callable using argument types
 (const(S)) const
 
 It is not specified how postblit is supposed to interoperate with
 const/immutable. Tagging the postblit function with 'const' doesn't help
 (compilation fails with the same error).
The same problem happens when using 'in', as in: void foo( in S s ) { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4867




https://github.com/D-Programming-Language/dmd/commit/eb7983c7215b51e5bb719803d48ccf2ed211ab5b

Now this issue is resolved, the mutable postblit is called on copied const
object.
But, this behavior temporarily allows breaking const correctness inside mutable
postblit.
Therefore, I don't close this issue.

Destructor has a similar problem, see bug 4338.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4867


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg gmail.com



16:53:04 MSK ---

 But, this behavior temporarily allows breaking const correctness inside mutable
 postblit.
 Therefore, I don't close this issue.
Consolidated into Issue 8956. Do not close this issue as a duplicate because it is another issue. E.g. it can be closed as WONTFIX if postblits will become qualifier-overloadable. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 03 2012