We can't fully implement this without compiler support (see PR80265) but this adds _GLIBCXX17_CONSTEXPR where possible. I've left /* _GLIBCXX17_CONSTEXPR */ comments where we need to add it once the compiler allows it. * include/bits/char_traits.h (__gnu_cxx::char_traits): Add _GLIBCXX14_CONSTEXPR on assign, compare, find, and length. (std::char_traits, std::char_traits): Add _GLIBCXX17_CONSTEXPR on assign. (std::char_traits, std::char_traits): Add _GLIBCXX17_CONSTEXPR on assign, compare, find, and length. * testsuite/21_strings/char_traits/requirements/ constexpr_functions_c++17.cc: New test. Tested powerpc64le-linux, committed to trunk.