August 11, 2010 [Issue 4616] New: Link error with copy constructor of nested struct | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4616 Summary: Link error with copy constructor of nested struct Product: D Version: D2 Platform: x86 OS/Version: All Status: NEW Keywords: link-failure Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: rsinfu@gmail.com --- Comment #0 from Shin Fujishiro <rsinfu@gmail.com> 2010-08-10 21:42:57 PDT --- If a struct N is nested inside another struct S and N has a field of type S, then defining a copy constructor of N causes a linker error. The error occurs only when N has a field of type S. -------------------- test.d struct S { struct N { S s; this(this) {} // error } } -------------------- The error on FreeBSD: -------------------- % dmd test.d test.o(.text._D4test1S1N8__cpctorMFKS4test1S1NZv+0x18): In function `_D4test1S1N8__cpctorMFKS4test1S1NZv': : multiple definition of `_D4test1S1N8__cpctorMFKS4test1S1NZv' test.o(.text._D4test1S1N8__cpctorMFKS4test1S1NZv+0x0): first defined here -------------------- The error on Windows: -------------------- >dmd test.d OPTLINK (R) for Win32 Release 8.00.2 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Offset 00403H Record Type 00C3 Error 1: Previous Definition Different : _D4test1S1N8__cpctorMFKS4test1S1NZv -------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 17, 2012 [Issue 4616] Link error with copy constructor of nested struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shin Fujishiro | http://d.puremagic.com/issues/show_bug.cgi?id=4616 Dmitry S <ds.dlang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ds.dlang@gmail.com --- Comment #1 from Dmitry S <ds.dlang@gmail.com> 2012-12-17 01:45:51 PST --- This no longer seems to be reproducible. With dmd compiled from the current head, the following code (a bit more involved to test it better) compiles and works (on MacOSX): import std.stdio; struct S { struct N { S s; this(this) { s.value += 1; } } int value = 17; } int main() { S.N n1; S.N n2 = n1; writefln("%d %d", n1.s.value, n2.s.value); return 0; } Prints "17 18". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation