fix Issue 10254 - Purity correctness is broken with constructor

This commit is contained in:
k-hara 2013-06-06 23:04:42 +09:00
parent bf71d1e067
commit 92bef24f2f
6 changed files with 29 additions and 5 deletions

View file

@ -1430,6 +1430,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=')
*/ */
class Base64Exception : Exception class Base64Exception : Exception
{ {
@safe pure nothrow
this(string s, string fn = __FILE__, size_t ln = __LINE__) this(string s, string fn = __FILE__, size_t ln = __LINE__)
{ {
super(s, fn, ln); super(s, fn, ln);

View file

@ -37,6 +37,7 @@ import std.format;
*/ */
class ConvException : Exception class ConvException : Exception
{ {
@safe pure nothrow
this(string s, string fn = __FILE__, size_t ln = __LINE__) this(string s, string fn = __FILE__, size_t ln = __LINE__)
{ {
super(s, fn, ln); super(s, fn, ln);
@ -65,6 +66,7 @@ private auto convError(S, T)(S source, int radix, string fn = __FILE__, size_t l
fn, ln); fn, ln);
} }
@safe pure/* nothrow*/ // lazy parameter bug
private auto parseError(lazy string msg, string fn = __FILE__, size_t ln = __LINE__) private auto parseError(lazy string msg, string fn = __FILE__, size_t ln = __LINE__)
{ {
return new ConvException(text("Can't parse string: ", msg), fn, ln); return new ConvException(text("Can't parse string: ", msg), fn, ln);
@ -139,6 +141,7 @@ private
*/ */
class ConvOverflowException : ConvException class ConvOverflowException : ConvException
{ {
@safe pure nothrow
this(string s, string fn = __FILE__, size_t ln = __LINE__) this(string s, string fn = __FILE__, size_t ln = __LINE__)
{ {
super(s, fn, ln); super(s, fn, ln);
@ -2169,7 +2172,7 @@ Target parse(Target, Source)(ref Source p)
// static immutable string infinity = "infinity"; // static immutable string infinity = "infinity";
// static immutable string nans = "nans"; // static immutable string nans = "nans";
ConvException bailOut(string msg = null, string fn = __FILE__, size_t ln = __LINE__) ConvException bailOut()(string msg = null, string fn = __FILE__, size_t ln = __LINE__)
{ {
if (!msg) if (!msg)
msg = "Floating point conversion error"; msg = "Floating point conversion error";

View file

@ -51,11 +51,13 @@ version (DigitalMarsC)
*/ */
class FormatException : Exception class FormatException : Exception
{ {
@safe pure nothrow
this() this()
{ {
super("format error"); super("format error");
} }
@safe pure nothrow
this(string msg, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) this(string msg, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null)
{ {
super(msg, fn, ln, next); super(msg, fn, ln, next);

View file

@ -3357,6 +3357,7 @@ class CurlException : Exception
line = The line number where the exception occurred. line = The line number where the exception occurred.
next = The previous exception in the chain of exceptions, if any. next = The previous exception in the chain of exceptions, if any.
+/ +/
@safe pure nothrow
this(string msg, this(string msg,
string file = __FILE__, string file = __FILE__,
size_t line = __LINE__, size_t line = __LINE__,
@ -3378,6 +3379,7 @@ class CurlTimeoutException : CurlException
line = The line number where the exception occurred. line = The line number where the exception occurred.
next = The previous exception in the chain of exceptions, if any. next = The previous exception in the chain of exceptions, if any.
+/ +/
@safe pure nothrow
this(string msg, this(string msg,
string file = __FILE__, string file = __FILE__,
size_t line = __LINE__, size_t line = __LINE__,

View file

@ -45,8 +45,8 @@ class UTFException : Exception
uint[4] sequence; uint[4] sequence;
size_t len; size_t len;
@safe pure nothrow
UTFException setSequence(uint[] data...) @safe pure nothrow UTFException setSequence(uint[] data...)
{ {
import std.algorithm; import std.algorithm;
@ -58,13 +58,13 @@ class UTFException : Exception
return this; return this;
} }
@safe pure nothrow
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{ {
super(msg, file, line, next); super(msg, file, line, next);
} }
@safe pure
this(string msg, size_t index, string file = __FILE__, size_t line = __LINE__, Throwable next = null) this(string msg, size_t index, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{ {
import std.string; import std.string;

View file

@ -68,11 +68,13 @@ class Win32Exception : Exception
{ {
int error; int error;
@safe pure nothrow
this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null)
{ {
super(message, fn, ln, next); super(message, fn, ln, next);
} }
@safe pure
this(string message, int errnum, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) this(string message, int errnum, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null)
{ {
super(text(message, " (", errnum, ")"), fn, ln, next); super(text(message, " (", errnum, ")"), fn, ln, next);
@ -116,6 +118,7 @@ public:
Params: Params:
message = The message associated with the exception. message = The message associated with the exception.
*/ */
@safe pure
this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) this(string message, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null)
{ {
super(message, fn, ln, next); super(message, fn, ln, next);
@ -128,6 +131,7 @@ public:
message = The message associated with the exception. message = The message associated with the exception.
error = The Win32 error number associated with the exception. error = The Win32 error number associated with the exception.
*/ */
@safe pure
this(string message, int error, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null) this(string message, int error, string fn = __FILE__, size_t ln = __LINE__, Throwable next = null)
{ {
super(message, error, fn, ln, next); super(message, error, fn, ln, next);
@ -782,12 +786,14 @@ private void regProcessNthValue(HKEY hkey, scope void delegate(scope LONG delega
*/ */
class Key class Key
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_hkey !is null); assert(m_hkey !is null);
} }
private: private:
@safe pure nothrow
this(HKEY hkey, string name, bool created) this(HKEY hkey, string name, bool created)
in in
{ {
@ -1147,12 +1153,14 @@ private:
*/ */
class Value class Value
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_key !is null); assert(m_key !is null);
} }
private: private:
@safe pure nothrow
this(Key key, string name, REG_VALUE_TYPE type) this(Key key, string name, REG_VALUE_TYPE type)
in in
{ {
@ -1363,12 +1371,14 @@ foreach (string subkeyName; key.keyNames)
*/ */
class KeyNameSequence class KeyNameSequence
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_key !is null); assert(m_key !is null);
} }
private: private:
@safe pure nothrow
this(Key key) this(Key key)
{ {
m_key = key; m_key = key;
@ -1458,12 +1468,14 @@ foreach (Key subkey; key.keys)
*/ */
class KeySequence class KeySequence
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_key !is null); assert(m_key !is null);
} }
private: private:
@safe pure nothrow
this(Key key) this(Key key)
{ {
m_key = key; m_key = key;
@ -1565,12 +1577,14 @@ foreach (string valueName; key.valueNames)
*/ */
class ValueNameSequence class ValueNameSequence
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_key !is null); assert(m_key !is null);
} }
private: private:
@safe pure nothrow
this(Key key) this(Key key)
{ {
m_key = key; m_key = key;
@ -1659,12 +1673,14 @@ foreach (Value value; key.values)
*/ */
class ValueSequence class ValueSequence
{ {
@safe pure nothrow
invariant() invariant()
{ {
assert(m_key !is null); assert(m_key !is null);
} }
private: private:
@safe pure nothrow
this(Key key) this(Key key)
{ {
m_key = key; m_key = key;