Skip to content

Commit 0430aee

Browse files
milianwTessil
authored andcommitted
Mark error_message in numeric_cast as unused
In a release build without assertions or exceptions enabled, `TSL_RH_THROW_OR_TERMINATE` is essentially a no-op and we get a compiler warning that the error_message is unused: ``` In file included from .../robin-map/include/tsl/robin_map.h:34: .../robin-map/include/tsl/robin_hash.h:77:35: warning: unused parameter 'error_message' [-Wunused-parameter] const char* error_message = "numeric_cast() failed.") { ^ 1 warning generated ``` Fix this by adding a `TSL_RH_UNUSED` for the error message here. In C++17, the `[[maybe_unused]]` should be used instead.
1 parent 851a59e commit 0430aee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/tsl/robin_hash.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ static T numeric_cast(U value,
8787
TSL_RH_THROW_OR_TERMINATE(std::runtime_error, error_message);
8888
}
8989

90+
TSL_RH_UNUSED(error_message)
91+
9092
return ret;
9193
}
9294

0 commit comments

Comments
 (0)