Skip to content

Commit

Permalink
Make integral serialization nothrow
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrejMitrovic committed Jul 2, 2023
1 parent 1222b9f commit 1c18e11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/google/protobuf/encoding.d
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ unittest
assert((-1L).toProtobuf!(Wire.zigzag).array == [0x01]);
}

nothrow unittest
{
cast(void)toProtobuf(byte(1));
cast(void)toProtobuf(short(1));
cast(void)toProtobuf(int(1));
cast(void)toProtobuf(long(1));
}

auto toProtobuf(T)(T value)
if (isFloatingPoint!T)
{
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/internal.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct Varint
private ubyte index;
private ubyte _length;

this(long value)
this(long value) nothrow
out { assert(_length > 0); }
do
{
Expand Down

0 comments on commit 1c18e11

Please sign in to comment.