Re: Problem with Exceptions in Constructor

2021-06-12 Thread Mike Brown via Digitalmars-d-learn
On Saturday, 12 June 2021 at 02:19:21 UTC, Mike Parker wrote: On Friday, 11 June 2021 at 20:09:22 UTC, Mike Brown wrote: The error is flagged on the writeln(e.msg). Do I need to do something special to pass a string to an exception? dup? No, that code is fine. You're passing a string lite

Re: Problem with Exceptions in Constructor

2021-06-11 Thread Mike Parker via Digitalmars-d-learn
On Friday, 11 June 2021 at 20:09:22 UTC, Mike Brown wrote: The error is flagged on the writeln(e.msg). Do I need to do something special to pass a string to an exception? dup? No, that code is fine. You're passing a string literal, so there's no need for a dup.

Problem with Exceptions in Constructor

2021-06-11 Thread Mike Brown via Digitalmars-d-learn
Hi all, AddressSanitizer is throwing an access-violation error - I've managed to boil it down to this example: ```d import std.stdio; class example: Exception { this(string msg, string file = __FILE__, size_t line = __LINE__) { super(msg, file, line); } } class tes