Add tests for LWG 3206. NFC

llvm-svn: 363589
This commit is contained in:
Marshall Clow 2019-06-17 18:06:30 +00:00
parent a9191c8492
commit 2e550cabea
2 changed files with 25 additions and 2 deletions

View File

@ -90,5 +90,28 @@ int main(int, char**)
assert( year_month_day{sd} == ymd); // and back
}
// These two tests check the wording for LWG 3206
{
constexpr year_month_day ymd{year{1971}, month{1}, day{0}}; // bad day
static_assert(!ymd.ok(), "");
static_assert( ymd.year().ok(), "");
static_assert( ymd.month().ok(), "");
static_assert(!ymd.day().ok(), "");
constexpr sys_days sd{ymd};
static_assert(sd.time_since_epoch() == days{364}, "");
static_assert(sd == sys_days{ymd.year()/ymd.month()/day{1}} + (ymd.day() - day{1}), "");
}
{
constexpr year_month_day ymd{year{1970}, month{12}, day{32}}; // bad day
static_assert(!ymd.ok(), "");
static_assert( ymd.year().ok(), "");
static_assert( ymd.month().ok(), "");
static_assert(!ymd.day().ok(), "");
constexpr sys_days sd{ymd};
static_assert(sd.time_since_epoch() == days{365}, "");
static_assert(sd == sys_days{ymd.year()/ymd.month()/day{1}} + (ymd.day() - day{1}), "");
}
return 0;
}

View File

@ -73,7 +73,7 @@
<tr><td><a href="https://wg21.link/LWG3198">3198</a></td><td>Yes</td><td>Bad constraint on <tt>std::span::span()</tt></td><td>Cologne</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3199">3199</a></td><td>Yes</td><td><tt>istream &gt;&gt; bitset&lt;0&gt;</tt> fails</td><td>Cologne</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3202">3202</a></td><td>Yes</td><td>P0318R1 was supposed to be revised</td><td>Cologne</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3206">3206</a></td><td>Yes</td><td><tt>year_month_day</tt> conversion to <tt>sys_days</tt> uses not-existing member function</td><td>Cologne</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG3206">3206</a></td><td>Yes</td><td><tt>year_month_day</tt> conversion to <tt>sys_days</tt> uses not-existing member function</td><td>Cologne</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG3208">3208</a></td><td>Yes</td><td><tt>Boolean</tt>'s expression requirements are ordered inconsistently</td><td>Cologne</td><td>Nothing to do</td></tr>
<tr><td><a href="https://wg21.link/LWG3209">3209</a></td><td>Yes</td><td>Expression in <tt>year::ok()</tt> returns clause is ill-formed</td><td>Cologne</td><td></td></tr>
</table>
@ -107,7 +107,7 @@
<li>3198 - We already do this</li>
<li>3199 - Louis?</li>
<li>3202 - We already do this</li>
<li>3206 - Marshall?</li>
<li>3206 - We already do this; added a couple of explicit tests</li>
<li>3208 - Nothing to do; wording cleanup</li>
<li>3209 - Marshall?</li>
</ul>