Don <> changed:

           What    |Removed                     |Added
            Version|D1                          |D1 & D2

--- Comment #3 from Don <> 2012-03-22 05:36:47 PDT ---
Reduced test case (actually much longer, but doesn't require -inline -release,
and also fails on D2).

inc.d ---------------
struct C { void asdfg() {} }

import inc;

bool forceSemantic7745()
   C c;
  return true;
static assert(forceSemantic7745());

void f(C c) { auto x = &c.asdfg; }
void main() {}
dmd -c inc.d
dmd -c m.d
dmd m.o inc.o
inc.o: In function `_D3inc1C5asdfgMFZv':
inc.d:(.text._D3inc1C5asdfgMFZv+0x0): multiple definition of
m.o:m.d:(.text._D3inc1C5asdfgMFZv+0x0): first defined here

It happens because this has forced asdfg() to be semantically analyzed. I'm
using CTFE to do this, there are probably more direct ways.

PATCH (D2, also works for D1):
-- a/src/e2ir.c
+++ b/src/e2ir.c
@@ -3422,7 +3422,8 @@ elem *DelegateExp::toElem(IRState *irs)

     //printf("DelegateExp::toElem() '%s'\n", toChars());

-    if (func->semanticRun == PASSsemantic3done)
+     if (func->semanticRun == PASSsemantic3done
+         && func->parent == irs->m ) // bug 7745

The idea of the patch is that it should only write to the obj file if the
parent of the function belongs to this module.
Not sure if this is correct, but at least it still fixes the test case in 4820.
Perhaps it should run through all parents until it gets to the module.

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

Reply via email to