Bug 6651 – [SafeD] Exception/Throwable constructors are not @safe ?
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-12T06:17:00Z
Last change time
2013-07-02T09:35:05Z
Assigned to
nobody
Creator
dmitry.olsh
Comments
Comment #0 by dmitry.olsh — 2011-09-12T06:17:30Z
@safe class NewException : Exception
{
///
this(string msg, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line);
}
}
Results in:
safe.d(7): Error: safe function 'this' cannot call system function 'this'
The funny thing is that Exception still can be created/thrown in @safe functions, e.g. this compiles:
@safe void f()
{
new Exception("blah");
}
Comment #1 by hsteoh — 2013-07-02T09:35:05Z
This bug seems no longer present in git HEAD. Please reopen if there's still a problem.