Bug 8398 – enforceEx cannot be used with OutOfMemoryError

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-18T02:50:00Z
Last change time
2012-07-22T02:07:05Z
Assigned to
nobody
Creator
jakobovrum

Comments

Comment #0 by jakobovrum — 2012-07-18T02:50:51Z
This idiom would be quite useful to have: auto data = enforceEx!OutOfMemoryError(malloc(size)); However, OutOfMemoryError only provides this constructor: this(string file = __FILE__, size_t line = __LINE__, Throwable next = null ) I think enforceEx is at fault here, not OutOfMemoryError. The non-deprecated overload of enforceEx should allow for constructors of the above form, requiring the file and line but providing its own messsage.
Comment #1 by issues.dlang — 2012-07-22T00:44:27Z
Comment #2 by github-bugzilla — 2012-07-22T02:01:38Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/ed22f41ec263adf9c2828ac162ca28098f220f87 Fix for issue# 8398. https://github.com/D-Programming-Language/phobos/commit/e58385ac9421cccfb9fc329ebf6f1d0c45f925c7 Merge pull request #711 from jmdavis/enforce Fix for issue# 8398. (enforceEx cannot be used with OutOfMemoryError)
Comment #3 by github-bugzilla — 2012-07-22T02:04:44Z