digitalmars.D.bugs - [Issue 20432] New: assert() and in() don't support tuple expressions
- d-bugmail puremagic.com (31/31) Dec 05 2019 https://issues.dlang.org/show_bug.cgi?id=20432
https://issues.dlang.org/show_bug.cgi?id=20432 Issue ID: 20432 Summary: assert() and in() don't support tuple expressions Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: default_357-line yahoo.de Consider the following code: // this works assertThrown!AssertError({ assert(false, "hello world"); }(), "hello world"); // this doesn't work struct S { bool b; string s; } assertThrown!AssertError({ assert(S(false, "hello world").tupleof); }(), "hello world"); Likewise for in(). This is annoying, because it prevents writing functions that either return success or an error value, or rather forces to call them twice. --
Dec 05 2019