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: [email protected]
Reporter: [email protected]
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.
--