Skip to content

Commit 052b97f

Browse files
authored
Merge pull request #5100 from WalterBright/const-utf
add const to std.utf.UTFException.toString()
2 parents 8928adc + aef2ec6 commit 052b97f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

std/utf.d

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,17 @@ class UTFException : Exception
6666
}
6767

6868

69-
override string toString()
69+
override string toString() const
7070
{
7171
if (len == 0)
72-
return super.toString();
72+
{
73+
/* Exception.toString() is not marked as const, although
74+
* it is const-compatible.
75+
*/
76+
//return super.toString();
77+
auto e = () @trusted { return cast(Exception)super; } ();
78+
return e.toString();
79+
}
7380

7481
string result = "Invalid UTF sequence:";
7582

0 commit comments

Comments
 (0)