Skip to content
Snippets Groups Projects
Commit dc94eaab authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

libstdc++: Add a test checking for chrono::duration overflows

This test fails if chrono::days::rep or chrono::years::rep is a 32-bit
type, because a large days or years value silently overflows a 32-bit
integer when converted to seconds. It would be conforming to implement
chrono::days as chrono::duration<int32_t, ratio<86400>>, but would make
this overflow case more likely. Similarly for chrono::years,
chrono::months and chrono::weeks. This test is here to remind us not to
make that change lightly.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/duration/arithmetic/overflow_c++20.cc: New
	test.
parent 6c0f9584
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment