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

--- Comment #0 from Shin Fujishiro <> 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
: 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.
test.obj(test)  Offset 00403H Record Type 00C3 
 Error 1: Previous Definition Different : _D4test1S1N8__cpctorMFKS4test1S1NZv

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to