← Back to index
|
Original Bugzilla link
Bug 24386 – [REG 2.095.1] constructor has no function body with return type inference
Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-02-11T14:49:23Z
Last change time
2024-12-13T19:33:16Z
Assigned to
No Owner
Creator
Tim
Moved to GitHub: dmd#20400 →
Comments
Comment #0
by tim.dlang — 2024-02-11T14:49:23Z
The following code does not compile since DMD 2.095.1: ``` template FunctionParameters(alias F) { static if (is(typeof(F) P == __parameters)) alias FunctionParameters = P; } template numConstructorOverloads(Overloads...) { static if (Overloads.length == 0) enum numConstructorOverloads = false; else enum numConstructorOverloads = __traits(getOverloads, FunctionParameters!(Overloads[0]), "__ctor").length + numConstructorOverloads!(Overloads[1 .. $]); } enum MIXIN = q{ this(Params...)(auto ref Params params) if (numConstructorOverloads!(__traits(getOverloads, typeof(this), "__ctor"))) { } }; struct Wrapper(T) { T data; } struct Struct1 { Wrapper!(Struct2)* splitRef; this(long); this(int); mixin(MIXIN); } struct Struct2 { this(const(Struct1)* ) { } this(ref const(Struct2) ) { } mixin(MIXIN); } ``` The code compiled with DMD 2.095.0, but results in the following error message since DMD 2.095.1: Error: constructor `test.Struct1.this` has no function body with return type inference
Comment #1
by robert.schadek — 2024-12-13T19:33:16Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/20400
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB