Re: Is this a new bug ?

2022-09-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 24 September 2022 at 06:13:55 UTC, test123 wrote: If so please report it for me to bugs platform. I can not register one. ```d package { version(TEST) { static: } else { __gshared: } uint test = 0; } ``` ldmd2 -betterC -vtls -c ./test.d

Re: Is this a new bug ?

2022-09-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 24 September 2022 at 06:13:55 UTC, test123 wrote: If so please report it for me to bugs platform. This isn't a bug, the effect of keyword: things stop at the matching }. (static if and version don't introduce a namespace scope, but they still follow this rule for the { colon:

Re: Is this a new bug ?

2022-09-24 Thread test123 via Digitalmars-d-learn
On Saturday, 24 September 2022 at 07:11:12 UTC, rikki cattermole wrote: ```d version(all) { __gshared: uint test2; } uint test; ``` Output with -vtls: ``` Up to 2.079.1: Success with output: onlineapp.d(9): test is thread local Since 2.080.1: Success with output:

Re: Is this a new bug ?

2022-09-24 Thread rikki cattermole via Digitalmars-d-learn
```d version(all) { __gshared: uint test2; } uint test; ``` Output with -vtls: ``` Up to 2.079.1: Success with output: onlineapp.d(9): test is thread local Since 2.080.1: Success with output: onlineapp.d(9): `test` is thread local ``` Looks fine to me.

Is this a new bug ?

2022-09-24 Thread test123 via Digitalmars-d-learn
If so please report it for me to bugs platform. I can not register one. ```d package { version(TEST) { static: } else { __gshared: } uint test = 0; } ``` ldmd2 -betterC -vtls -c ./test.d ./test.d(7): `test` is thread local

Re: Is this a new bug ?

2019-07-20 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 20 July 2019 at 14:19:08 UTC, Adam D. Ruppe wrote: Like the other person said, try/catch turns throws to nothrow. The `debug` keyword disables pure checks. Those make this easy without any mixin or wrappers/casts at all. But even if you did want to do the mixin route, look at

Re: Is this a new bug ?

2019-07-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 20 July 2019 at 09:01:21 UTC, Newbie2019 wrote: I want to cast std.stdio : writefln into pure function pointer, so I can call it from debug pure function. Like the other person said, try/catch turns throws to nothrow. The `debug` keyword disables pure checks. Those make this easy

Re: Is this a new bug ?

2019-07-20 Thread Boris Carvajal via Digitalmars-d-learn
On Saturday, 20 July 2019 at 09:01:47 UTC, Newbie2019 wrote: On Saturday, 20 July 2019 at 09:01:21 UTC, Newbie2019 wrote: I want to cast std.stdio : writefln into pure function pointer, so I can call it from debug pure function. is there a way to work around the pure check for call writefln

Re: Is this a new bug ?

2019-07-20 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 20 July 2019 at 09:01:21 UTC, Newbie2019 wrote: I want to cast std.stdio : writefln into pure function pointer, so I can call it from debug pure function. is there a way to work around the pure check for call writefln ? nothrow check, not pure.

Re: Is this a new bug ?

2019-07-20 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 20 July 2019 at 06:43:03 UTC, user1234 wrote: use `__traits(identifier)` instead of `.stringof`, see https://dlang.org/spec/traits.html#identifier. as explained this is not a new bug, not even a bug according to me. I want to cast std.stdio : writefln into pure function

Re: Is this a new bug ?

2019-07-20 Thread user1234 via Digitalmars-d-learn
shared immutable " ~ N ~ "_P " ~ P ~"= cast(" ~ N ~ "_P) &" ~ N ~ " ;" ; } use `__traits(identifier)` instead of `.stringof`, see https://dlang.org/spec/traits.html#identifier. as explained this is not a new bug, not even a bug according to me.

Re: Is this a new bug ?

2019-07-19 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 20 July 2019 at 04:18:15 UTC, Adam D. Ruppe wrote: show me what you're doing now and I'll see which case it is. Most the time I see these, the code is significantly simplified and bugs fixed by removing the usages of these strings.. I want to do this in betterC: template

Re: Is this a new bug ?

2019-07-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 20 July 2019 at 04:10:53 UTC, Newbie2019 wrote: I may not fully understand why I can done it without identifier.stringof show me what you're doing now and I'll see which case it is. Most the time I see these, the code is significantly simplified and bugs fixed by removing the

Re: Is this a new bug ?

2019-07-19 Thread Newbie2019 via Digitalmars-d-learn
On Saturday, 20 July 2019 at 03:58:36 UTC, Adam D. Ruppe wrote: You should never actually need that! What is your use case? In most cases I see people doing .stringof, the correct solution is to simply... not. Use the local name directly. If you do need the name - and the only cases for this

Re: Is this a new bug ?

2019-07-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 20 July 2019 at 03:31:41 UTC, Newbie2019 wrote: template Test(alias T){ pragma(msg, T.stringof); Believe it or not, but this can result in the function being called. This is D's optional parenthesis feature, to do simple property syntax. Not a bug. I want get the

Is this a new bug ?

2019-07-19 Thread Newbie2019 via Digitalmars-d-learn
template Test(alias T){ pragma(msg, T.stringof); enum Test = T.stringof; } string t1; void t2(){} void t3(string s){} extern(C) void main(){ enum x1 = Test!(t1); // ok enum x2 = Test!(t2); // expect t2, but get t2() enum x3 = Test!(t3); //Error: