Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-08 Thread Exil via Digitalmars-d-learn
On Saturday, 7 September 2019 at 22:19:48 UTC, Jonathan M Davis wrote: On Saturday, September 7, 2019 3:40:58 PM MDT Exil via Digitalmars-d-learn wrote: On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis wrote: > @safe: > @system: > > then @system overrides @safe.

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-07 Thread Exil via Digitalmars-d-learn
On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis wrote: @safe: @system: then @system overrides @safe. Just to add onto this, you can't do: @safe @system void foo(); // error but you can do: extern(C++, ns1) extern(C++, ns2) void foo(); // ok

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-07 Thread Exil via Digitalmars-d-learn
On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis wrote: makes no sense whatsoever IMHO. IIRC, this version of extern(C++) didn't go through the DIP process and was simply added via a PR. The original extern(C++) worked the same way. Since it was implemented in v2.066.0 by the

Re: segfault in ldc release only - looks like some kind of optimization bug?

2019-07-22 Thread Exil via Digitalmars-d-learn
On Tuesday, 23 July 2019 at 00:54:08 UTC, aliak wrote: On Tuesday, 23 July 2019 at 00:36:49 UTC, Exil wrote: auto ref get(T)(W!T value) { return value.front; } You're returning a reference to a temporary that gets deleted at the end of the function's scope. The "auto ref" here will be a "

Re: segfault in ldc release only - looks like some kind of optimization bug?

2019-07-22 Thread Exil via Digitalmars-d-learn
auto ref get(T)(W!T value) { return value.front; } You're returning a reference to a temporary that gets deleted at the end of the function's scope. The "auto ref" here will be a "ref".

Re: Why does a switch break cause a segmentation fault

2019-07-22 Thread Exil via Digitalmars-d-learn
On Monday, 22 July 2019 at 22:05:17 UTC, adamgoldberg wrote: Hey, I just happened to be writing a program in D an stumbled upon a bug, that causes it to terminate after receiving a SEGV signal, nothing wierd so far but it looks everything I tried shows it is the break statement inside of a swit

Re: Why does `static foreach` lead to something calling `~=` internally?

2019-07-09 Thread Exil via Digitalmars-d-learn
On Sunday, 7 July 2019 at 18:45:14 UTC, 0xEAB wrote: On Sunday, 7 July 2019 at 16:51:57 UTC, 0xEAB wrote: Why does this `static foreach` lead to hidden usage of operator Further notes by Dan (aka "Wild"): I added some small printfs to the compiler, http://ix.io/1NWM It seems like it lowers i

Re: Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Exil via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 08:45:45 UTC, Andre Pany wrote: Hi, I have a module a.d --- struct TestClass { string name; string fileName; } TestClass[] testClasses; mixin template UnitTest() { private static string getFileName(string fileName = __FILE__) {