Re: is this a betterC bug ?

2018-08-15 Thread Mike Franklin via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 08:14:53 UTC, Petar Kirov [ZombineDev] wrote: It's not a bug, it's all about how the type system is set up. The type of an array literal expression like `[1, 2, 3]` is `int[]` (a slice of an array of ints), so no matter if you do: auto readonly(T)(const(T)[]

Re: is this a betterC bug ?

2018-08-15 Thread Petar via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 08:14:53 UTC, Petar Kirov [ZombineDev] wrote: https://run.dlang.io/is/iD9ydu I made a typo in one of the comments. Here's the fixed version: https://run.dlang.io/is/HRqYcZ

Re: is this a betterC bug ?

2018-08-15 Thread Petar via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 17:49:32 UTC, Mike Franklin wrote: On Tuesday, 14 August 2018 at 17:22:42 UTC, Seb wrote: FYI: staticArray will be part of 2.082, it already works with dmd-nightly: That just seems wrong. Isn't the fact that `staticArray` is needed a bug in the compiler? I

Re: is this a betterC bug ?

2018-08-14 Thread Mike Franklin via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 17:22:42 UTC, Seb wrote: FYI: staticArray will be part of 2.082, it already works with dmd-nightly: That just seems wrong. Isn't the fact that `staticArray` is needed a bug in the compiler? I think the compiler could have lowered to something like that

Re: is this a betterC bug ?

2018-08-14 Thread Seb via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 16:31:38 UTC, Paul Backus wrote: On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC Workaround:

Re: is this a betterC bug ?

2018-08-14 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC Workaround: https://run.dlang.io/is/NZykl0 Source:

Re: is this a betterC bug ?

2018-08-14 Thread Seb via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC You can use `static immutable` as a workaround for now:

Re: is this a betterC bug ?

2018-08-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:16:50 UTC, Nicholas Wilson wrote: On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC Yes.

Re: is this a betterC bug ?

2018-08-14 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 13:01:57 UTC, learnfirst1 wrote: enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC Yes. https://issues.dlang.org/show_bug.cgi?id=19169

is this a betterC bug ?

2018-08-14 Thread learnfirst1 via Digitalmars-d-learn
enum string[] a = ["a"]; extern(C) void main() { int i = 0; auto s = a[i]; } --- Error: TypeInfo cannot be used with -betterC