imbue.pass.cpp 996 B

1234567891011121314151617181920212223242526272829303132333435
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // REQUIRES: locale.en_US.UTF-8
  9. // <regex>
  10. // template <class charT, class traits = regex_traits<charT>> class basic_regex;
  11. // locale_type imbue(locale_type loc);
  12. #include <regex>
  13. #include <locale>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. #include "platform_support.h" // locale name macros
  17. int main(int, char**)
  18. {
  19. std::regex r;
  20. std::locale loc = r.imbue(std::locale(LOCALE_en_US_UTF_8));
  21. assert(loc.name() == "C");
  22. assert(r.getloc().name() == LOCALE_en_US_UTF_8);
  23. loc = r.imbue(std::locale("C"));
  24. assert(loc.name() == LOCALE_en_US_UTF_8);
  25. assert(r.getloc().name() == "C");
  26. return 0;
  27. }