[Issue 23920] New: object.require modifies AA before populating value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 13 11:56:28 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23920

          Issue ID: 23920
           Summary: object.require modifies AA before populating value
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

////////////////// test.d //////////////////
void main()
{
    int[int] aa;
    try
        aa.require(5, {
            if (true)
                throw new Exception("oops");
            else
                return 1;
        }());
    catch (Exception e) {}
    assert(5 !in aa);
}
////////////////////////////////////////////

This allows bypassing the type system, as it allows the "construction" of types
with `@disable this();`.

--


More information about the Digitalmars-d-bugs mailing list