Thread overview
[Issue 4499] New: calls to @disabled postblit are emitted
Jul 24, 2010
Christian Kamm
Feb 27, 2011
Kenji Hara
Mar 30, 2011
Walter Bright
July 24, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4499

           Summary: calls to @disabled postblit are emitted
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: kamm-removethis@incasoftware.de


--- Comment #0 from Christian Kamm <kamm-removethis@incasoftware.de> 2010-07-23 23:55:37 PDT ---
The following code triggers the "can't happen" assert.

struct S {
  @disable this(this) { assert(false, "can't happen"); }
  void foo() {}
}

auto foo() {
  S s;
  return s;
}

void main() {
  auto s = foo();
  s.foo();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4499


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg@gmail.com
           Platform|Other                       |All
         OS/Version|Linux                       |All


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-02-26 22:33:22 PST ---
Following patch fixes this bug.

 src/s2ir.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/s2ir.c b/src/s2ir.c
index 08d802b..95991b6 100644
--- a/src/s2ir.c
+++ b/src/s2ir.c
@@ -1252,6 +1252,10 @@ void ReturnStatement::toIR(IRState *irs)
                 {   StructDeclaration *sd = ((TypeStruct *)tb)->sym;
                     if (sd->postblit)
                     {   FuncDeclaration *fd = sd->postblit;
+                        if (fd->storage_class & STCdisable)
+                        {
+                            fd->toParent()->error(loc, "is not copyable
because it is annotated with @disable");
+                        }
                         elem *ec = el_var(irs->shidden);
                         ec = callfunc(loc, irs, 1, Type::tvoid, ec,
tb->pointerTo(), fd, fd->type, NULL, NULL);
                         es = el_bin(OPcomma, ec->Ety, es, ec);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 30, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4499


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-03-30 14:51:34 PDT ---
https://github.com/9rnsr/dmd/commit/c623c7982131fc7ed0f53493ec50d3422a042eb0

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