libstdc++: Check static assertions earlier in chrono::duration
authorJonathan Wakely <jwakely@redhat.com>
Mon, 21 Nov 2022 11:52:34 +0000 (11:52 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 21 Nov 2022 17:46:42 +0000 (17:46 +0000)
commited77dcb9be76e592b62449c75a5e751485514afd
treef3567c9e885b2c357173c2f3fc481eae0d70d5e2
parent94f7baf2194e2d20108c9d34d2766e6b14e25cef
libstdc++: Check static assertions earlier in chrono::duration

This ensures that we fail a static assertion before giving any other
errors. Instantiating chrono::duration<int, chrono::seconds> will now
print this before the other errors caused by it:

error: static assertion failed: period must be a specialization of ratio

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (duration): Check preconditions on
template arguments before using them.
libstdc++-v3/include/bits/chrono.h