February 17, 2023 [Issue 17541] Function attribute deduction depends on compile invocation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17541 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |snarwin+bugzilla@gmail.com --- Comment #13 from Paul Backus <snarwin+bugzilla@gmail.com> --- Another example, from Discord: --- test.d module test; void main(){ import test2; MyStruct.RcPtr gl_indcies = MyStruct.RcPtr(MyStruct()); } --- test2.d module test2; struct MyStruct{ alias Ptr = Unique!MyStruct; alias RcPtr = SafeRefCounted!MyStruct; ~this(){} } struct SafeRefCounted(T){ struct RefCountedStore{ struct Impl{ T _payload; } Impl* _store; } RefCountedStore* _refCounted; this(T)(T arg){} ~this(){ destroy(_refCounted._store._payload); } } struct Unique(T){ alias RefT = T*; void opAssign(U)(Unique!U u) if (is(u.RefT:RefT)){} ~this(){ destroy(*_p); } RefT _p; } --- When compiled together, there is no error: --- $ dmd -c test.d test2.d && dmd test.o test2.o $ echo $? 0 --- When compiled separately, linking fails: --- $ dmd -c test.d && dmd -c test2.d && dmd test.o test2.o /usr/bin/ld: test.o: in function `_Dmain': test.d:(.text._Dmain[_Dmain]+0x2f): undefined reference to `_D5test2__T14SafeRefCountedTSQBb8MyStructZQBf6__dtorMFZv' collect2: error: ld returned 1 exit status Error: linker exited with status 1 --- Examining the object files shows that this is due to mismatched attributes: --- $ nm test.o | ddemangle | grep 'SafeRefCounted.*__dtor' U void test2.SafeRefCounted!(test2.MyStruct).SafeRefCounted.__dtor() $ nm test2.o | ddemangle | grep 'SafeRefCounted.*__dtor' 0000000000000000 W pure nothrow @nogc @safe void test2.SafeRefCounted!(test2.MyStruct).SafeRefCounted.__dtor() --- Reproduced with DMD 2.102.0 on 64-bit Linux. -- |
February 26, 2023 [Issue 17541] Function attribute deduction depends on compile invocation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17541 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |212fahrenheit@posteo.us --- Comment #14 from Paul Backus <snarwin+bugzilla@gmail.com> --- *** Issue 23723 has been marked as a duplicate of this issue. *** -- |
August 12 [Issue 17541] Function attribute deduction depends on compile invocation | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17541 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #15 from Dlang Bot <dlang-bot@dlang.rocks> --- @ljmf00 created dlang/dmd pull request #15534 "Fix Issue 17541 - @safe/pure/nothrow attribute deduction depends on c…" fixing this issue: - Fix Issue 17541 - @safe/pure/nothrow attribute deduction depends on compile invocation A reboot of #10959 follow-up plus implementation for `nothrow`. Signed-off-by: Luís Ferreira <contact@lsferreira.net> https://github.com/dlang/dmd/pull/15534 -- |
Copyright © 1999-2021 by the D Language Foundation