<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">In the tests, we have the following usage:<div><br></div><div><div>#if TEST_STD_VER > 14</div><div># if !defined(__cpp_lib_filesystem)</div><div>#  error "__cpp_lib_filesystem is not defined"</div><div># elif __cpp_lib_filesystem < 201703L</div><div>#  error "__cpp_lib_filesystem has an invalid value"</div><div># endif</div><div>#endif</div></div><div><br></div><div>I submit that that's non-portable, because some standard libraries may not implement all the features (that's the point of the feature-test macro), and this test should not fail.</div><div><br></div><div>In D55308, I am using the following form:</div><div><br></div><div><div>#if TEST_STD_VER > 17</div><div>  LIBCPP_ASSERT(IS_DEFINED(__cpp_lib_char8_t)); // libc++ implements this</div><div># if defined(__cpp_lib_char8_t)</div><div>#  if __cpp_lib_char8_t < 201811L</div><div>#   error "__cpp_lib_char8_t has an invalid value"</div><div>#  endif</div><div># endif</div><div>#endif</div></div><div><br></div><div>Basically it (unconditionally) checks that if the macro is defined, then it has a sane value.</div><div>Additionally, since we know that libc++ defines this, we check that.</div><div><br></div><div>An alternate formulation - w/o the `IS_DEFINED` trickery.</div><div><br></div><div><div><div>#if TEST_STD_VER > 17</div><div># if !defined(__cpp_lib_char8_t)  </div><div>  LIBCPP_STATIC_ASSERT(false, "__cpp_lib_char8_t is not defined");</div><div># else</div><div>#  if __cpp_lib_char8_t < 201811L</div><div>#   error "__cpp_lib_char8_t has an invalid value"</div><div>#  endif</div><div># endif</div><div>#endif</div></div><div><br></div><div>Comments welcome.</div><div><br></div>-- Marshall</div></div></div></div></div>