Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Mark exception class constructors as @nogc
Browse files Browse the repository at this point in the history
The exception class constructors do not themselves allocate any memory in the garbage collector, so they can be marked as @nogc. This enables the exception constructors to be used with custom allocators in the future in @nogc code.
  • Loading branch information
w0rp committed Apr 18, 2015
1 parent c4aa60e commit d6addb9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/object_.d
Expand Up @@ -1365,14 +1365,14 @@ class Throwable : Object
*/
Throwable next;

@safe pure nothrow this(string msg, Throwable next = null)
@nogc @safe pure nothrow this(string msg, Throwable next = null)
{
this.msg = msg;
this.next = next;
//this.info = _d_traceContext();
}

@safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
@nogc @safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
{
this(msg, next);
this.file = file;
Expand Down Expand Up @@ -1491,12 +1491,12 @@ class Exception : Throwable
* This constructor does not automatically throw the newly-created
* Exception; the $(D throw) statement should be used for that purpose.
*/
@safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
@nogc @safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{
super(msg, file, line, next);
}

@safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
@nogc @safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line, next);
}
Expand Down Expand Up @@ -1547,13 +1547,13 @@ class Error : Throwable
* This constructor does not automatically throw the newly-created
* Error; the $(D throw) statement should be used for that purpose.
*/
@safe pure nothrow this(string msg, Throwable next = null)
@nogc @safe pure nothrow this(string msg, Throwable next = null)
{
super(msg, next);
bypassedException = null;
}

@safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
@nogc @safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
{
super(msg, file, line, next);
bypassedException = null;
Expand Down

0 comments on commit d6addb9

Please sign in to comment.