mixin template bug with opBinary?

2022-07-22 Thread Anthony Quizon via Digitalmars-d-learn
A and B. I get: ``` foo.d(16): Error: mixin `foo.B.opBi!(B, ["+":function (B a, B b) pure nothrow @nogc @safe => a])` does not match template declaration `opBi(A, A function(A, A)[string] f0)` ``` Is this a bug or am I doing something wrong?

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Mike Parker via Digitalmars-d-learn
On Friday, 1 July 2022 at 13:44:20 UTC, Chris Katko wrote: It appears module access to a class is broken until the constructor finishes. No, it has nothing to do with the module. It's the reference itself. Until the constructor returns, the reference through which you're constructing the

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Chris Katko via Digitalmars-d-learn
On Friday, 1 July 2022 at 13:28:26 UTC, Chris Katko wrote: ...wait, does "world" not 'exist' until after the constructor finishes? Is that's what's going on? But then why does it 'exist' when I send it directly? Is it only "registered" with the module once this() finishes or something like

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Chris Katko via Digitalmars-d-learn
On Friday, 1 July 2022 at 13:12:05 UTC, Adam D Ruppe wrote: On Friday, 1 July 2022 at 12:57:01 UTC, Chris Katko wrote: Cannot access memory at address 0x10 Looks like an ordinary null pointer. How did you create the variable? D bool initialize() //called from main {

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Mike Parker via Digitalmars-d-learn
On Friday, 1 July 2022 at 13:20:15 UTC, Mike Parker wrote: r. And that also looks like the source of your original segfault. You've got a circular reference going on in the constructors. In other words, you're constructing a global world instance, which in turn constructs an elf instance,

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Mike Parker via Digitalmars-d-learn
On Friday, 1 July 2022 at 13:01:30 UTC, Chris Katko wrote: Forgot the last line. That's important because world MUST exist by time elf is called... because world... created and called elf. So it's not a memory issue, but some sort of linkage issue. world is null because the constructor

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 1 July 2022 at 12:57:01 UTC, Chris Katko wrote: Cannot access memory at address 0x10 Looks like an ordinary null pointer. How did you create the variable?

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Chris Katko via Digitalmars-d-learn
Forgot the last line. That's important because world MUST exist by time elf is called... because world... created and called elf. So it's not a memory issue, but some sort of linkage issue.

Re: dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Chris Katko via Digitalmars-d-learn
To add, I cannot even access g.world from inside elf's constructor. ... which is the function that called it. D Thread 1 "main" received signal SIGSEGV, Segmentation fault. objects.elf.this(g.pair, objects.atlasHandler) (this=, atlas=, _pos=...) at ./src/objects.d:320 (gdb) bt #0

dlang bug - accessing module variable from method segfaults only when using module reference directly

2022-07-01 Thread Chris Katko via Digitalmars-d-learn
dmd (but I think LDC also is affected) this bug has bit me multiple times now, to the point I can recognize it. Accessing module variables, from inside a method, causes a segfault. Even if the variable should be available by then through the call order. Proving that its a bug, you can

Re: Bug in dmd?

2022-06-16 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 16:53:13 UTC, mw wrote: Create a simple test case, file bug at: https://issues.dlang.org/ I tried. No luck.

Re: Bug in dmd?

2022-06-15 Thread mw via Digitalmars-d-learn
Create a simple test case, file bug at: https://issues.dlang.org/

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 09:24:35 UTC, Dukc wrote: Now when I think of it, perhaps the fact that private `printHelp` has the same name as the public `printHelp` is somehow confusing dmd. If you try to rename the private `printHelp` and it's call in the public one to something else, you

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 09:21:28 UTC, user1234 wrote: On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey- [Line (2)

Re: Bug in dmd?

2022-06-15 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 15 June 2022 at 07:38:36 UTC, JG wrote: I tried to reproduce it but wasn't able (I guess it is some interplay with the rest of your code): I tried this first but got the same result as you. I think my small library overheats DMD's template engine.

Re: Bug in dmd?

2022-06-15 Thread Dukc via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 23:56:58 UTC, Andrey Zherikov wrote: On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote: No idea. The functions seems indeed to be exactly the same, so I assume this is a DMD bug. It cannot be a bug in `std.sumtype`, since that would trigger in both

Re: Bug in dmd?

2022-06-15 Thread user1234 via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey- [Line (2) produces](https://github.com/andrey-zherikov/argparse/runs/6880350900?check_suite_focus=true#step:5:12) `undefined reference to

Re: Bug in dmd?

2022-06-15 Thread JG via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 23:56:58 UTC, Andrey Zherikov wrote: On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote: No idea. The functions seems indeed to be exactly the same, so I assume this is a DMD bug. It cannot be a bug in `std.sumtype`, since that would trigger in both

Re: Bug?

2022-06-15 Thread JG via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 19:49:39 UTC, Steven Schveighoffer wrote: On 6/14/22 3:35 PM, JG wrote: Hi, Is this a bug? ```d import std; template test(alias f) {     auto test(I)(I i) { return f(i); } } void main() {     alias t = test!(x=>x+1);     1.t.writeln; //<--Doesn't c

Re: Bug in dmd?

2022-06-14 Thread Andrey Zherikov via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote: No idea. The functions seems indeed to be exactly the same, so I assume this is a DMD bug. It cannot be a bug in `std.sumtype`, since that would trigger in both of the templates. This definitely triggers some bug in DMD because

Re: Bug in dmd?

2022-06-14 Thread Dukc via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote: I have [pretty simple code in my library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47): ```d alias CC = SumType!(AA,BB); struct AA {} struct BB { CC[] c; } private void ppp(T, Output

Re: Bug?

2022-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/22 3:35 PM, JG wrote: Hi, Is this a bug? ```d import std; template test(alias f) {     auto test(I)(I i) { return f(i); } } void main() {     alias t = test!(x=>x+1);     1.t.writeln; //<--Doesn't compile     1.test!(x=>x+1).writeln;     t(1).writeln; } ``` Not a b

Bug?

2022-06-14 Thread JG via Digitalmars-d-learn
Hi, Is this a bug? ```d import std; template test(alias f) { auto test(I)(I i) { return f(i); } } void main() { alias t = test!(x=>x+1); 1.t.writeln; //<--Doesn't compile 1.test!(x=>x+1).writeln; t(1).writeln; } ```

Bug in dmd?

2022-06-14 Thread Andrey Zherikov via Digitalmars-d-learn
I have [pretty simple code in my library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47): ```d alias CC = SumType!(AA,BB); struct AA {} struct BB { CC[] c; } private void ppp(T, Output)(auto ref Output output, in CommandArguments!T cmd, in Config

Bug?

2022-05-26 Thread JG via Digitalmars-d-learn
Hi, I was reading the source of std.algorithm cache and saw some code that didn't make sense to me with a comment indexing the [bug report](https://issues.dlang.org/show_bug.cgi?id=15891). Could anyone help to understand if this code is really necessary (meaning I have some misconception

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Denis Feklushkin via Digitalmars-d-learn
On Saturday, 18 December 2021 at 12:50:17 UTC, Tejas wrote: As Ali said, this is an implementation issue. So I guess the answer to your question is that this is a bug. Please file a report at [issues.dlang.org](issues.dlang.org) Looks like this is same case: https://issues.dlang.org

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Tejas via Digitalmars-d-learn
guess the answer to your question is that this is a bug. Please file a report at [issues.dlang.org](issues.dlang.org)

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-18 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 19:03:05 UTC, Tejas wrote: Well, I got completely mislead by my experiment  ```d struct S { ~this() immutable {} } ``` Interesting what discussed behaviour isn't affects method what implements same functionality as dtor and called explictly at each

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:51:56 UTC, Ali Çehreli wrote: On 12/17/21 10:01 AM, Tejas wrote: > [...] Storage, There is no such requirement nor guarantee. [...] Well, I got completely mislead by my experiment  ```d struct S { ~this() immutable {} } void main() { immutable S

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Ali Çehreli via Digitalmars-d-learn
On 12/17/21 10:01 AM, Tejas wrote: > I think since `immutable` objects are kept in Read Only Storage, There is no such requirement nor guarantee. > you > can't call destructors on them Destructor is nothing but a piece of code that is executed when an object's life ends. A destructor need

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:32:43 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 18:02:52 UTC, Tejas wrote: I improved your sample: ```d immutable struct S { ~this() {} } immutable struct S2 { S sss; ~this() {} } void main() { S2 s = S2(); } ``` ``` Error:

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:02:52 UTC, Tejas wrote: I improved your sample: ```d immutable struct S { ~this() {} } immutable struct S2 { S sss; ~this() {} } void main() { S2 s = S2(); } ``` ``` Error: `immutable` method `serializer_bug.S.~this` is not callable using a

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:19:34 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: I think since `immutable` objects are kept in Read Only Storage Some of them can be stored in ROM in some cases, but actually "immutable" keyword means "not mutable

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: I think since `immutable` objects are kept in Read Only Storage Some of them can be stored in ROM in some cases, but actually "immutable" keyword means "not mutable for whole its lifetime"

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: On Friday, 17 December 2021 at 17:34:05 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: [...] ("serializer_bug" is just name of my local .d file) I think since `immutable`

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Tejas via Digitalmars-d-learn
On Friday, 17 December 2021 at 17:34:05 UTC, Denis Feklushkin wrote: On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is ("serializer_bug" is

Re: This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is ("serializer_bug" is just name of my local .d file)

This is bug or not? (immutable class containing struct with dtor)

2021-12-17 Thread Denis Feklushkin via Digitalmars-d-learn
```d /+ dub.json: { "name": "test", "dependencies": { } } +/ struct S { ~this() {} } immutable class Imm { S s; // this is immutable value because whole class is immutable this() { s = S(); } ~this() {} // Comment out this to fix this compilation

Re: unit test broken [DUB bug?]

2021-12-16 Thread Andre Pany via Digitalmars-d-learn
On Monday, 13 December 2021 at 18:24:07 UTC, Andre Pany wrote: On Sunday, 12 December 2021 at 05:54:44 UTC, Chris Katko wrote: Running 64-bit Linux ``` dmd --version DMD64 D Compiler v2.098.0-beta.2 [...] I really recommend always using dub configurations, especially when you want to use

Re: unit test broken [DUB bug?]

2021-12-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/12/21 12:54 AM, Chris Katko wrote: Running 64-bit Linux ``` dmd --version DMD64 D Compiler v2.098.0-beta.2 dub --version DUB version 1.27.0-beta.2, built on Sep  7 2021 ``` the following code 'compiles' in one project. ```d unittest { gasdindgaslkdgansklnasgdlknaglkgansklsdg; } void

Re: unit test broken [DUB bug?]

2021-12-13 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 12 December 2021 at 05:54:44 UTC, Chris Katko wrote: Running 64-bit Linux ``` dmd --version DMD64 D Compiler v2.098.0-beta.2 [...] I really recommend always using dub configurations, especially when you want to use unit tests. The name of the first configuration doesn't matter.

Re: unit test broken [DUB bug?]

2021-12-12 Thread russhy via Digitalmars-d-learn
You are running the beta version of the compiler, and an older version of LDC2 I'd first try to update them to make sure you aren't missing any bug fixes

unit test broken [DUB bug?]

2021-12-11 Thread Chris Katko via Digitalmars-d-learn
ot;, "name": "widescreen" } ``` dub.json.selections (for broken project only) ```json { "fileVersion": 1, "versions": { "crypto": "0.2.16", "intel-intrinsics": "1.6.1" } } ```

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Brian Callahan via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:38:44 UTC, jfondren wrote: With nothing to the contrary, I'd take "must be terminated by a null pointer" as "can't itself be a null pointer". The execve(2) is more explicit: "The argument argv is a pointer to a null-terminated array of character pointers

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:38:44 UTC, jfondren wrote: [...] With nothing to the contrary, I'd take "must be terminated by a null pointer" as "can't itself be a null pointer". ah yeah, and thanks, of course ... how would the count of arg be known without the sentinel...

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread jfondren via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:21:52 UTC, Basile B. wrote: What do you think ? I'm very surprised that this is even allowed. Apparently it's Linux userspace that normally complains about it: https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/progname.c#n54 The manpages just say ```

Re: Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
On Sunday, 24 October 2021 at 14:21:52 UTC, Basile B. wrote: The following code, on linux [...] What do you think ? Forgot to say that this change ```diff - execv("a", null); + execv("a", ["whatever".ptr].ptr); ``` makes the problem goes away, so it would be caused by how `null` args are

Possible runtime bug in preprocessing of command line arguments passed to the D main

2021-10-24 Thread Basile B. via Digitalmars-d-learn
The following code, on linux ```d module runnable; ​ extern(C) int execv(const char* p, const char** args); ​ immutable src = ` import std.getopt; void main(string[] args) { bool c; getopt(args, "c", ); } `; ​ void prepareProgram() { import std.process :

Re: Sort bug / strangeness

2021-10-01 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Oct 01, 2021 at 06:30:48PM +, Danny Arends via Digitalmars-d-learn wrote: [...] > Is there a sort() algorithm that avoids swapping the items themselves > and e.g. just returns the indexes so I can reorder the original array > myself ?

Re: Sort bug / strangeness

2021-10-01 Thread Danny Arends via Digitalmars-d-learn
On Friday, 1 October 2021 at 17:53:24 UTC, Steven Schveighoffer wrote: I think your struct is different than this, because this only happens if aliasing is inside the struct being sorted (i.e. it has pointers). Your presented struct doesn't have pointers, and the code you linked to is

Re: Sort bug / strangeness

2021-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/21 12:44 PM, Danny Arends wrote: Hey all, Using a modified 3D A* tile searching algorithm, full code see: https://github.com/DannyArends/CalderaD/blob/master/src/math/search.d I get the following AssertError, 'sometimes' but not always on running the code: mutation.d(2816): Swap:

Sort bug / strangeness

2021-10-01 Thread Danny Arends via Digitalmars-d-learn
Hey all, Using a modified 3D A* tile searching algorithm, full code see: https://github.com/DannyArends/CalderaD/blob/master/src/math/search.d I get the following AssertError, 'sometimes' but not always on running the code: mutation.d(2816): Swap: rhs points to lhs. the first time I hit

Re: Is this a compiler aliasing bug?

2021-09-22 Thread Chris Katko via Digitalmars-d-learn
On Friday, 17 September 2021 at 10:29:12 UTC, bauss wrote: On Friday, 17 September 2021 at 09:44:53 UTC, Chris Katko wrote: [...] It's not a bug because "obj.x" referes to the same symbol that is "this.x" Alias will create an alias for a symbol, not an expression or t

Re: Is this a compiler aliasing bug?

2021-09-17 Thread bauss via Digitalmars-d-learn
} /* output: x1: 50 y1: 81 w1: 5 h1: 6 x2: 50 y2: 81 w2: 5 h2: 6 < x1: 50 y1: 81 w1: 5 h1: 6 x2: 200 y2: 86.54 w2: 26 h2: 16 < */ ``` The arrows point to the dependency. The top two sets of numbers should _not_ be identical. It's not a bug bec

Re: Is this a compiler aliasing bug?

2021-09-17 Thread ag0aep6g via Digitalmars-d-learn
if it's considered a bug.

Is this a compiler aliasing bug?

2021-09-17 Thread Chris Katko via Digitalmars-d-learn
I'm debugging some code I wrote back in 2017 and a bounding box collision detection kept giving spurious answers till I resorted to assuming nothing and dumped every variable and alias. I kept getting results like it was checking against itself, and of course, that would result in finding a

Re: Create alias of same name in inner scope, bug or feature?

2021-08-14 Thread Tejas via Digitalmars-d-learn
On Saturday, 14 August 2021 at 08:23:20 UTC, user1234 wrote: On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote: [...] Oh right, the ```.``` operator will reference variable in the _module_ scope, not just the _immediate outer scope_, you can use the module name to disambiguate as

Re: Create alias of same name in inner scope, bug or feature?

2021-08-14 Thread user1234 via Digitalmars-d-learn
On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote: [...] Oh right, the ```.``` operator will reference variable in the _module_ scope, not just the _immediate outer scope_, you can use the module name to disambiguate as well. To extend Mike answer, the general rule is that if you can

Re: Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Tejas via Digitalmars-d-learn
On Saturday, 14 August 2021 at 04:01:31 UTC, Mike Parker wrote: On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote: ```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main()

Re: Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote: ```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main() { writeln(macro_1(15, 20)); alias macro_1 = def;// is

Create alias of same name in inner scope, bug or feature?

2021-08-13 Thread Tejas via Digitalmars-d-learn
```d import std; auto abc(T)(auto ref T a, auto ref T b){ return a+b; } auto def(T)(auto ref T a, auto ref T b){ return a*b; } alias macro_1 = abc; void main() { writeln(macro_1(15, 20)); alias macro_1 = def;// is this NOT considered variable shadowing?

Re: Unknown bug disallows growth of dynamic arrays

2021-07-01 Thread solidstate1991 via Digitalmars-d-learn
On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote: Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the

Re: Unknown bug disallows growth of dynamic arrays

2021-06-28 Thread frame via Digitalmars-d-learn
On Monday, 28 June 2021 at 21:45:05 UTC, frame wrote: The SpriteLayer.addSprite() method accepts ushort. That's max. 65535. You supply 65_536. Ah I mixed the argumets, forget that. However, your comment //ocd.objects[65_536] may also I hint that you try to access elements that are not

Re: Unknown bug disallows growth of dynamic arrays

2021-06-28 Thread frame via Digitalmars-d-learn
On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote: Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the

Unknown bug disallows growth of dynamic arrays

2021-06-28 Thread solidstate1991 via Digitalmars-d-learn
Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the function `_d_arraysetlengthT`. Variable `ti` is a TypeInfo_Array,

Re: A possible readf int bug

2021-06-27 Thread Matilda via Digitalmars-d-learn
On Sunday, 27 June 2021 at 20:12:09 UTC, jfondren wrote: On Sunday, 27 June 2021 at 19:50:09 UTC, Matilda wrote: [...] This works with either readf line for me on v2.097.0. Try stracing your program. Okay, thank you. I'll try it out.

Re: A possible readf int bug

2021-06-27 Thread jfondren via Digitalmars-d-learn
There is no error message. It just waits for nothing apparently. It works with the stip.to!int line, so the problem must be with readf. I'm kind of new to this language and I don't have much experience with programming in general, so I have no way to know if it's just me being dumb or I've accident

A possible readf int bug

2021-06-27 Thread Matilda via Digitalmars-d-learn
. It works with the stip.to!int line, so the problem must be with readf. I'm kind of new to this language and I don't have much experience with programming in general, so I have no way to know if it's just me being dumb or I've accidently found a bug. I use DMD32 D Compiler v2.097.0-dirty

Re: Is this bug ? format %(%)

2021-04-07 Thread Meta via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 17:31:09 UTC, Paul Backus wrote: On Wednesday, 7 April 2021 at 17:04:56 UTC, novice2 wrote: On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote: So, you should change your code to writefln("%-(%s, %)", s); sorry i dont read docs so carefully

Re: Is this bug ? format %(%)

2021-04-07 Thread Berni44 via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 17:31:09 UTC, Paul Backus wrote: It's not your fault--this is a pretty obscure feature, and it's not documented very well. Even after you've found the correct page in the documentation (the page for `formattedWrite` [1]), you have to scroll down past multiple

Re: Is this bug ? format %(%)

2021-04-07 Thread Ali Çehreli via Digitalmars-d-learn
On 4/7/21 10:04 AM, novice2 wrote: On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote: So, you should change your code to     writefln("%-(%s, %)", s); sorry i dont read docs so carefully thanks For the sake of completeness, I mention this feature in a couple of other places:

Re: Is this bug ? format %(%)

2021-04-07 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 17:04:56 UTC, novice2 wrote: On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote: So, you should change your code to writefln("%-(%s, %)", s); sorry i dont read docs so carefully thanks It's not your fault--this is a pretty obscure feature, and

Re: Is this bug ? format %(%)

2021-04-07 Thread novice2 via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 13:43:18 UTC, Paul Backus wrote: So, you should change your code to writefln("%-(%s, %)", s); sorry i dont read docs so carefully thanks

Re: Is this bug ? format %(%)

2021-04-07 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 13:31:59 UTC, novice3 wrote: there is extra quotes, wich not present in firmat specifier. is this bug, or i should change something in my code? This is actually an intentional feature (albeit kind of a stupid one). From the documentation: Inside a compound

Is this bug ? format %(%)

2021-04-07 Thread novice3 via Digitalmars-d-learn
https://run.dlang.io/is/p4NVp8 ```d void main() { import std.stdio: writefln; string[] s = ["a", "b", "c"]; writefln("%(%s, %)", s); } ``` output ```d "a", "b", "c" ``` expected ```d a, b, c ``` there is extra

Re: can't link a code, is it a bug or my fault?

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:41:27 UTC, rikki cattermole wrote: Try it with: -allinst It may just be deciding a template instance isn't required. The error message could maybe be changed to include this? "Try -allinst bla bla"

Re: can't link a code, is it a bug or my fault?

2021-03-17 Thread Iliya via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:41:27 UTC, rikki cattermole wrote: Try it with: -allinst It may just be deciding a template instance isn't required. Good workaround for such kind of bugs! ) Up to 2.063 : Failure with output: Error: unrecognized switch '-allinst' Since 2.064 :

Re: can't link a code, is it a bug or my fault?

2021-03-11 Thread rikki cattermole via Digitalmars-d-learn
Try it with: -allinst It may just be deciding a template instance isn't required.

Re: can't link a code, is it a bug or my fault?

2021-03-11 Thread Ali Çehreli via Digitalmars-d-learn
On 3/11/21 8:41 AM, Iliya wrote: > I am using dmd 2.094.1 on linux Your program links fine for me with 2.094.2 on Linux. Ali

Re: can't link a code, is it a bug or my fault?

2021-03-11 Thread Iliya via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:25:35 UTC, Ali Çehreli wrote: On 3/11/21 8:41 AM, Iliya wrote: > I am using dmd 2.094.1 on linux Your program links fine for me with 2.094.2 on Linux. Ali Thank you, Ali! I also played with it on playground. Seems that it is a bug. The compilation resu

can't link a code, is it a bug or my fault?

2021-03-11 Thread Iliya via Digitalmars-d-learn
on: 1. Why compiler searches for such function attributes - pure nothrow @nogc @safe, as I don't specify them. Is this a bug or feature?) 2. What changes are needed to compile this rather simple example. Please, help me! Reference to my piece of code in app.d: struct IsEqual(T) { static

Re: help: cannot build profdump, dub error (bug): Enforcement failed

2020-09-29 Thread drug via Digitalmars-d-learn
On 9/29/20 4:38 PM, drug wrote: It reproduces. As a workaround you can use ``` dub run profdump ``` this command works as expected, I guess it is a bug of dub Do not execute this command in cloned `profdump` repository - it will fail too. It works if is called from other places, for example

Re: help: cannot build profdump, dub error (bug): Enforcement failed

2020-09-29 Thread drug via Digitalmars-d-learn
On 9/29/20 3:41 PM, mw wrote: I remember I used to able to build this package: https://github.com/AntonMeep/profdump but now, I cannot. Since that package haven't changed for 2 years, maybe it's a dub bug? System information $ uname -a Linux  4.15.0-117-generic #118-Ubuntu SMP Fri Sep 4 20

help: cannot build profdump, dub error (bug): Enforcement failed

2020-09-29 Thread mw via Digitalmars-d-learn
I remember I used to able to build this package: https://github.com/AntonMeep/profdump but now, I cannot. Since that package haven't changed for 2 years, maybe it's a dub bug? System information $ uname -a Linux 4.15.0-117-generic #118-Ubuntu SMP Fri Sep 4 20:02:41 UTC 2020 x86_64

Re: Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 20:55:34 UTC, Andrey Zherikov wrote: I think the issue is here: https://github.com/dlang/dmd/blob/master/src/dmd/root/filename.d#L736-L748 Yes, issue is there. This change (removal of "c == '\\' || ") fixes it: diff --git a/src/dmd/root/filename.d

Re: Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 19:13:47 UTC, Adam D. Ruppe wrote: On Wednesday, 2 September 2020 at 18:40:55 UTC, Andrey Zherikov wrote: If I provide -Jfoo to dmd, doesn't it mean my consent to use the contents of directory foo? Yeah, but dmd has been inconsistent on platforms about if it

Re: Bug in import(...) on Windows?

2020-09-02 Thread Steven Schveighoffer via Digitalmars-d-learn
foo\bar" paths on Windows. I don't know why it wouldn't work with native paths on Windows. But I'm not a DMD maintainer, so I don't know where to look in the code to see why it doesn't work. It might be worth filing a bug. https://issues.dlang.org -Steve

Re: Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 20:23:15 UTC, Steven Schveighoffer wrote: What I'm wondering is if it needs to be ./file instead of .\file. Can you hard code that and see if it works? This actually works: pragma(msg, import("file")); pragma(msg, buildPath(".", "file"));

Re: Bug in import(...) on Windows?

2020-09-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/2/20 1:47 PM, Adam D. Ruppe wrote: On Wednesday, 2 September 2020 at 17:39:04 UTC, Andrey Zherikov wrote: Is this a bug in dmd? I think it is an old bug filed (I can't find it though) about inconsistent platform behavior but it is allowed by spec for the compiler to reject any path

Re: Bug in import(...) on Windows?

2020-09-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 18:40:55 UTC, Andrey Zherikov wrote: If I provide -Jfoo to dmd, doesn't it mean my consent to use the contents of directory foo? Yeah, but dmd has been inconsistent on platforms about if it allows subdirectories. Right now I think it just strips all slashes

Re: Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 17:47:47 UTC, Adam D. Ruppe wrote: On Wednesday, 2 September 2020 at 17:39:04 UTC, Andrey Zherikov wrote: Is this a bug in dmd? I think it is an old bug filed (I can't find it though) about inconsistent platform behavior but it is allowed by spec

Re: Bug in import(...) on Windows?

2020-09-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 17:39:04 UTC, Andrey Zherikov wrote: Is this a bug in dmd? I think it is an old bug filed (I can't find it though) about inconsistent platform behavior but it is allowed by spec for the compiler to reject any path components. import("") is suppos

Re: Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
Adding some verbosity: pragma(msg, import("file")); pragma(msg, buildPath(".", "file")); pragma(msg, import(buildPath(".", "file"))); Result on Ubuntu: === hello ./file hello === Result on Windows: === hello .\file parser.d(47): Error: file ".\\file" cannot be found

Bug in import(...) on Windows?

2020-09-02 Thread Andrey Zherikov via Digitalmars-d-learn
run test.d Result on Ubuntu: === hello hello === Result on Windows: === hello test.d(46): Error: file ".\\file" cannot be found or not in a path specified with -J test.d(46):while evaluating pragma(msg, import(buildPath([".", "file"][]))) === Is this a bug in dmd?

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-07 Thread Steven Schveighoffer via Digitalmars-d-learn
are allocated on the caller's stack instead; so adding `scope` for these variadics *should* probably do the same: void tester(Test test, scope Test[] tests...); Note that without the initial parameter, or without the destructor, they do NOT end up on the heap. I think this is a bug

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-07 Thread Steven Schveighoffer via Digitalmars-d-learn
; so adding `scope` for these variadics *should* probably do the same: void tester(Test test, scope Test[] tests...); Note that without the initial parameter, or without the destructor, they do NOT end up on the heap. I think this is a bug, and not a "feature". I can't see any

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 22:02:37 UTC, Kayomn wrote: On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote: Similar case here; the 'varargs' end up in a GC-allocated array. I've recently changed `scope` slice params, so that array literal arguments are allocated on the caller's stack instead;

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote: Similar case here; the 'varargs' end up in a GC-allocated array. I've recently changed `scope` slice params, so that array literal arguments are allocated on the caller's stack instead; so adding `scope` for these variadics *should*

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:25:11 UTC, Kayomn wrote: Though, admittedly I'm kind of used to seeing this error message since it appears any time you try and do something that relies on type info in betterC, intentionally or not. A notable example is forgetting to supply an arrange length when

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread Kayomn via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:25:11 UTC, Kayomn wrote: example is forgetting to supply an arrange length when array length*

<    1   2   3   4   5   6   7   8   9   10   >