[Issue 16479] Missing substitution while mangling C++ template parameter for functions
https://issues.dlang.org/show_bug.cgi?id=16479 --- Comment #4 from Mathias LANG --- This is actually quite a non-trivial problem. Take the following code in C++: ``` #include template std::array* getArray(const T* data) { auto ret = new std::array; for (size_t idx = 0; idx < S; ++idx) (*ret)[idx] = data[idx]; return ret; } void unused () { getArray<5, bool>(nullptr); getArray<3, int>(nullptr); getArray<5, char>(nullptr); } ``` This gives the following symbols on OSX: ``` T __Z6unusedv 00c0 T __Z8getArrayILm3EiEPNSt3__15arrayIT0_XT_EEEPKS2_ 0040 T __Z8getArrayILm5EbEPNSt3__15arrayIT0_XT_EEEPKS2_ 0140 T __Z8getArrayILm5EcEPNSt3__15arrayIT0_XT_EEEPKS2_ U __Znwm ``` I mentioned OSX because on Linux, the inlined namespace `__1` might not be present, thus the symbol (and substitutions) will differ, but the bug is still there on Linux. The equivalent D code is as follow: ``` extern(C++, std) extern (C++, __1) { public struct array (T, /*size_t*/ cpp_ulong N) { private T[N > 0 ? N : 1] __elems_; } } extern (C++) array!(T, S)* getArray (cpp_ulong S, T) (const(T)* data); void main () { const d1 = [true, false, true, false, true]; const d2 = [42, 84, 1992]; const d3 = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; getArray!5(d1.ptr); getArray!3(d2.ptr); getArray!6(d3.ptr); // Not 7 on purpose } ``` This will produce the following symbols with DMD master: ``` nm types.o | grep getArray U __Z8getArrayILm3EiEPNSt3__15arrayIiLm3EEEPKi U __Z8getArrayILm5EbEPNSt3__15arrayIbLm5EEEPKb U __Z8getArrayILm6EcEPNSt3__15arrayIcLm6EEEPKc ``` There are 2 issues here: - We don't do template parameter substituion, so we end up with the string "[...]arrayI{i,b,c}Lm{3,5,6}E" to represent `array<{int,bool,char}, {3,4,6}>` instead of `arrayIT0_XT_E` (using substitution for `getArray`'s template parameter. - We don't do substitution for the function parameter. clang++ will use `S2_` as substitution and g++ `S1_` (because there's no inline namespace) instead of `{i,b,c}`. It's surprising because substitution does not normally happen for basic types, but I suppose template parameters are special. Note that this is non-trivial to solve because of the following case: ``` template struct Bar { }; template Bar foo () { return Bar{}; } void unused () { foo<1, 2>(); foo<1, 1>(); } ``` This generates the following symbols: ``` 0030 T __Z3fooILi1ELi1EE3BarIXT0_EXT_EEv 0020 T __Z3fooILi1ELi2EE3BarIXT0_EXT_EEv T __Z6unusedv ``` Which means we cannot solely rely on the value of the template parameters, we have to track which one is used where, but I don't think we have this information in the frontend at the moment... --
[Issue 15691] Improve error message for struct member initializer
https://issues.dlang.org/show_bug.cgi?id=15691 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 15691] Improve error message for struct member initializer
https://issues.dlang.org/show_bug.cgi?id=15691 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f3001177457b00031875779a555ff581d9c62360 Fix Issue 15691 - Improve error message for struct member initializer https://github.com/dlang/dmd/commit/ecc8d829b473e8477110305a759e568d94c5 Merge pull request #8352 from RazvanN7/Issue_15691 Fix Issue 15691 - Improve error message for struct member initializer merged-on-behalf-of: Jacob Carlborg --
[Issue 4620] C++ constructor and template mangling, C++ ABI patch
https://issues.dlang.org/show_bug.cgi?id=4620 Mathias LANG changed: What|Removed |Added Status|NEW |RESOLVED CC||pro.mathias.l...@gmail.com Resolution|--- |WONTFIX --- Comment #5 from Mathias LANG --- Indeed the code has evolved a lot since then, and C++ interfacing is much easier in D nowadays. Closing as WONTFIX so it doesn't show up in the changelog. --
[Issue 16479] Missing substitution while mangling C++ template parameter for functions
https://issues.dlang.org/show_bug.cgi?id=16479 Mathias LANG changed: What|Removed |Added CC||pro.mathias.l...@gmail.com Hardware|x86_64 |All Summary|Wrong C++ mangling for |Missing substitution while |template|mangling C++ template ||parameter for functions --- Comment #3 from Mathias LANG --- Edited the title to make it a bit clearer. I was hit by this today. DMD does not respect this part of the spec: ``` When function and member function template instantiations reference the template parameters in their parameter or result types, the template parameter number is encoded, with the sequence T_, T0_, ... ``` Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.template-param --
[Issue 18493] [betterC] Can't use aggregated type with postblit
https://issues.dlang.org/show_bug.cgi?id=18493 Mike Franklin changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED |--- --- Comment #9 from Mike Franklin --- This is not yet fixed. Still needs https://github.com/dlang/dmd/pull/8253 and maybe some more druntime work. --
[Issue 15691] Improve error message for struct member initializer
https://issues.dlang.org/show_bug.cgi?id=15691 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #1 from RazvanN --- PR: https://github.com/dlang/dmd/pull/8352 --
[Issue 18973] New: @disable on const toHash causes unresolved symbol error
https://issues.dlang.org/show_bug.cgi?id=18973 Issue ID: 18973 Summary: @disable on const toHash causes unresolved symbol error Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: elpenguin...@gmail.com Annotating const toHash methods with @disable causes unresolved symbol errors in the link stage. ``` struct X { @disable size_t toHash() const; } ``` will cause ``` onlineapp.o:onlineapp.d:_D22TypeInfo_S9onlineapp1X6__initZ: error: undefined reference to '_D9onlineapp1X6toHashMxFZm' ``` --
[Issue 18493] [betterC] Can't use aggregated type with postblit
https://issues.dlang.org/show_bug.cgi?id=18493 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 18493] [betterC] Can't use aggregated type with postblit
https://issues.dlang.org/show_bug.cgi?id=18493 --- Comment #8 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/d676ffa836204dded541101b74dff8ae8131ad5d Fix Issue 18493 - [betterC] Can't use aggregated type with postblit https://github.com/dlang/druntime/commit/a2cabb8e668434521aff45f4d064fcf48780fb11 Merge pull request #2184 from JinShil/betterC_nothrow Fix Issue 18493 - [betterC] Can't use aggregated type with postblit merged-on-behalf-of: Sebastian Wilzbach --
[Issue 15690] [ICE] backend/symbol.c 1032
https://issues.dlang.org/show_bug.cgi?id=15690 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --
[Issue 15755] DMD segfault upon alias on alias on __trait(getAttributes, ...)
https://issues.dlang.org/show_bug.cgi?id=15755 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #2 from RazvanN --- PR: https://github.com/dlang/dmd/pull/8353 --
[Issue 15754] can access alias from instance but not from type
https://issues.dlang.org/show_bug.cgi?id=15754 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --- Comment #1 from RazvanN --- The code in the original bug post now compiles successfully with master git HEAD. Closing as fixed. --
[Issue 18975] New: permutations.array creates an array of the original type without the permutations
https://issues.dlang.org/show_bug.cgi?id=18975 Issue ID: 18975 Summary: permutations.array creates an array of the original type without the permutations Product: D Version: D2 Hardware: x86_64 OS: Mac OS X Status: NEW Severity: minor Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: someone_i_dont_k...@outlook.com Weird title, but the problem is that using permutations.some_lazy_range_algorithm.array returns an array of the original elements, without the permutations. See code : --- bug.d void main() { import std.algorithm : permutations; import std.stdio : writeln; import std.array : array; [1, 2, 3].permutations.writeln; //prints : [[1, 2, 3], [2, 1, 3], [3, 1, 2], [1, 3, 2], [2, 3, 1], [3, 2, 1]] [1, 2, 3].permutations.array.writeln; //prints : [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]] } --- bug seems to affect all versions from 2.69 onwards, per run.dlang.io : https://run.dlang.io/is/PLWWRo --
[Issue 18976] New: Inconsistency in overload merging with aliases
https://issues.dlang.org/show_bug.cgi?id=18976 Issue ID: 18976 Summary: Inconsistency in overload merging with aliases Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: pro.mathias.l...@gmail.com Consider the following code: ``` class Expression : Statement {} class Statement {} class AssertSemanticVisitor { void visit (const Statement node) { assert(0, typeof(node).stringof); } } class ExpressionVisitor : AssertSemanticVisitor { public void visit (Expression) { assert(0); } version (Deprecated) alias visit = super.visit; else version (FullType) alias visit = AssertSemanticVisitor.visit; else alias visit = typeof(super).visit; } void main () { scope x = new ExpressionVisitor; scope y = new Statement; x.visit(y); } ``` All three `alias` should have the same effect, bar for the deprecation newly implemented for the `Deprecated` version. However, the first 2 versions perform as expected, however the `else` clause leads to: ``` test.d(21): Error: alias `test.ExpressionVisitor.visit` conflicts with function test.ExpressionVisitor.visit at test.d(14) `` Marking it as major, as it makes the deprecation somewhat annoying. --
[Issue 18974] New: ICE with mixin templates, inheritance and overloading
https://issues.dlang.org/show_bug.cgi?id=18974 Issue ID: 18974 Summary: ICE with mixin templates, inheritance and overloading Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: pro.mathias.l...@gmail.com This kills DMD: ``` class Expression {} class Statement : Expression {} private template AssertFalse (T, Ret) { Ret visit (const T node) { assert(0, T.stringof); } } class AssertSemanticVisitor (Node) { mixin AssertFalse!(Statement, void) A; mixin AssertFalse!(Expression, void) B; } class ExpressionVisitor : AssertSemanticVisitor!(void) { public override void visit (Expression) { assert(0); } } ``` A debug build shows: ``` --- ERROR: This is a compiler bug. Please report it via https://issues.dlang.org/enter_bug.cgi with, preferably, a reduced, reproducible example and the information below. DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the reduction. --- DMD v2.080.1-317-gda13edb77 predefs DigitalMars Posix linux ELFv1 LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 CRuntime_Glibc D_LP64 D_PIC assert D_HardFloatbinary ../dmd/generated/linux/release/64/dmd version v2.080.1-317-gda13edb77 config../dmd/generated/linux/release/64/dmd.conf DFLAGS-I../dmd/generated/linux/release/64/../../../../../druntime/import -I../dmd/generated/linux/release/64/../../../../../phobos -L-L../dmd/generated/linux/release/64/../../../../../phobos/generated/linux/release/64 -L--export-dynamic -fPIC --- core.exception.AssertError@dmd/dsymbolsem.d(3453): Assertion failure ??:? _d_assertp [0xe754a7c9] ??:? _ZN22DsymbolSemanticVisitor23funcDeclarationSemanticEP15FuncDeclaration [0xe7371bde] ??:? _ZN22DsymbolSemanticVisitor5visitEP15FuncDeclaration [0xe73722e0] ??:? _ZN15FuncDeclaration6acceptEP7Visitor [0xe73c513d] ??:? _Z15dsymbolSemanticP7DsymbolP5Scope [0xe736868c] ??:? _ZN22DsymbolSemanticVisitor14attribSemanticEP17AttribDeclaration [0xe736c3e6] ??:? _ZN22DsymbolSemanticVisitor5visitEP17AttribDeclaration [0xe736c448] ??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP15ProtDeclaration [0xe7448d82] ??:? _ZN15ProtDeclaration6acceptEP7Visitor [0xe730b095] ??:? _Z15dsymbolSemanticP7DsymbolP5Scope [0xe736868c] ??:? _ZN22DsymbolSemanticVisitor5visitEP16ClassDeclaration [0xe7375e4c] ??:? _ZN16ClassDeclaration6acceptEP7Visitor [0xe7335e95] ??:? _Z15dsymbolSemanticP7DsymbolP5Scope [0xe736868c] ??:? _ZN22DsymbolSemanticVisitor5visitEP6Module [0xe736d779] ??:? _ZN6Module6acceptEP7Visitor [0xe7357e09] ??:? _Z15dsymbolSemanticP7DsymbolP5Scope [0xe736868c] ??:? int dmd.mars.tryMain(ulong, const(char)**) [0xe73fc19b] ??:? _Dmain [0xe73fd582] ``` --
[Issue 15690] [ICE] backend/symbol.c 1032
https://issues.dlang.org/show_bug.cgi?id=15690 --- Comment #2 from hst...@quickfur.ath.cx --- Tested on latest git master (153db26c226d84a27a926810025b91eb6583849c), confirmed that this no longer crashes the compiler. Compiler output: -- test.d(20): Deprecation: use { } for an empty statement, not ; test.d(15): Error: case variable i declared at test.d(13) cannot be declared in switch body -- --
[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)
https://issues.dlang.org/show_bug.cgi?id=17712 --- Comment #11 from Basile B. --- interesting fact: The problem doesn't happen when std.conv.toChars template parameter `radix` is changed from `ubyte` to `int` or when it changed to an `alias radix = 10` --
[Issue 17712] [REG 2.074] [LINK] Undefined reference to std.conv.toChars!(10, char, 1, uint).toChars(uint)
https://issues.dlang.org/show_bug.cgi?id=17712 --- Comment #12 from Basile B. --- speculative could fail because it wrongly thinks that it will ALREADY be codegened. in toImpl (line 1394 of std.conv) we have --- return toChars!(10, EEType)(value + 0).array; --- but if we specifies the type of value: --- return toChars!(10, EEType, LetterCase.lower, typeof(value + 0))(value + 0).array; --- than the test case passes. Maybe IFTI fails/is wrong with "value + 0", trick to promote) and then it gives another template that is HIM codegened. --
[Issue 18976] Inconsistency in overload merging with aliases
https://issues.dlang.org/show_bug.cgi?id=18976 Mike Franklin changed: What|Removed |Added Keywords||pull CC||slavo5...@yahoo.com --- Comment #1 from Mike Franklin --- Fix: https://github.com/dlang/dmd/pull/8355 --
[Issue 15068] wrong error message on attempting to use type as template
https://issues.dlang.org/show_bug.cgi?id=15068 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 15068] wrong error message on attempting to use type as template
https://issues.dlang.org/show_bug.cgi?id=15068 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8fe101636f9aeeb896bbcd6bcc8b4005df915e33 Fix Issue 15068 - wrong error message on attempting to use type as template https://github.com/dlang/dmd/commit/153db26c226d84a27a926810025b91eb6583849c Merge pull request #8351 from RazvanN7/Issue_15068 Fix Issue 15068 - wrong error message on attempting to use type as template --
[Issue 15842] struct is being copied when returned directly
https://issues.dlang.org/show_bug.cgi?id=15842 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@yahoo.com --- Comment #5 from Steven Schveighoffer --- What is there to test? Either way is valid -- you can have the struct constructed in one location, and then moved to the return value, or you can have it constructed in place for the return value. There is no postblit or dtor, so the struct is movable without any notification. IMO, this should be resolved INVALID. --
[Issue 4620] C++ constructor and template mangling, C++ ABI patch
https://issues.dlang.org/show_bug.cgi?id=4620 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@yahoo.com --- Comment #6 from Steven Schveighoffer --- (In reply to Mathias LANG from comment #5) > Indeed the code has evolved a lot since then, and C++ interfacing is much > easier in D nowadays. Closing as WONTFIX so it doesn't show up in the > changelog. Just a note: it only shows in the changelog if there is a git log message that references this bug -- all the changelog is auto-generated these days. --
[Issue 15842] struct is being copied when returned directly
https://issues.dlang.org/show_bug.cgi?id=15842 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |FIXED --- Comment #3 from RazvanN --- Running both examples in the original bug report on master git HEAD results in printing the same address. Closing as fixed. --
[Issue 15842] struct is being copied when returned directly
https://issues.dlang.org/show_bug.cgi?id=15842 --- Comment #4 from Atila Neves --- I'd only close the bug if there's a test in the testsuite that would fail if the current behaviour ever changes. --
[Issue 18970] DMD segfault due to opDispatch
https://issues.dlang.org/show_bug.cgi?id=18970 Seb changed: What|Removed |Added CC||greensunn...@gmail.com --- Comment #1 from Seb --- PR https://github.com/dlang/dmd/pull/8354 --