Hi !
Does anybody knows why dmd segfaults on this code ? Should I
report this as a bug ?
import std.stdio;
enum LiftingGender
{
PREDICT,
UPDATE,
}
struct Test(float[][] coeffs,
int[] offsets,
LiftingGender gender)
{
immutable float[][] coeffs = coeffs
matovitch:
Does anybody knows why dmd segfaults on this code ? Should I
report this as a bug ?
Please report this minimized case to Bugzilla:
struct Foo(int[] arr) {
const int[] arr = arr;
}
void main() {
Foo!([0]) foo;
}
The error it gives before the crash:
test.d(2,17
On Saturday, 31 May 2014 at 17:01:23 UTC, bearophile wrote:
matovitch:
Does anybody knows why dmd segfaults on this code ? Should I
report this as a bug ?
Please report this minimized case to Bugzilla:
struct Foo(int[] arr) {
const int[] arr = arr;
}
void main() {
Foo!([0]) foo
In fact it segfauls on any template parameter if it has the same
name as the immutable member (at least it's coherent). Something
as simple as :
struct Foo(int i)
{
immutable int i = i;
}
void main()
{
Foo!5 foo;
writeln(foo);
}
I am suprised that nobody tried this before. BTW I
I remembered my psswd don't take my last sentence into account (i
will filed this).
On Saturday, 31 May 2014 at 17:22:41 UTC, matovitch wrote:
In fact it segfauls on any template parameter if it has the
same name as the immutable member (at least it's coherent).
Something as simple as :
struct Foo(int i)
{
immutable int i = i;
}
void main()
{
Foo!5 foo;
I updated the issue. Strangely if done in the main everything is
fine :
Error: undefined identifier i
On Sat, May 31, 2014 at 04:50:11PM +, matovitch via Digitalmars-d-learn
wrote:
Hi !
Does anybody knows why dmd segfaults on this code ? Should I report
this as a bug ?
[...]
Compiler segfaults should always be reported. No matter how wrong the
code may be, it is never right
I just filed a bug report (
http://d.puremagic.com/issues/show_bug.cgi?id=11067)
Is there a workaround that keeps same syntax for user code?
Use case: i'm generating those from swig(+modifications to map C++
templates to D templates) so I can't factor the template bodies for
different template