allocator.ctor.pass.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. // <memory>
  9. // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
  10. //
  11. // template <class T>
  12. // class allocator
  13. // {
  14. // public: // All of these are constexpr after C++17
  15. // constexpr allocator() noexcept;
  16. // constexpr allocator(const allocator&) noexcept;
  17. // template<class U> constexpr allocator(const allocator<U>&) noexcept;
  18. // ...
  19. // };
  20. #include <memory>
  21. #include <cstddef>
  22. #include "test_macros.h"
  23. int main(int, char**)
  24. {
  25. {
  26. typedef std::allocator<char> AC;
  27. typedef std::allocator<long> AL;
  28. constexpr AC a1;
  29. constexpr AC a2{a1};
  30. constexpr AL a3{a2};
  31. (void) a3;
  32. }
  33. {
  34. typedef std::allocator<const char> AC;
  35. typedef std::allocator<const long> AL;
  36. constexpr AC a1;
  37. constexpr AC a2{a1};
  38. constexpr AL a3{a2};
  39. (void) a3;
  40. }
  41. return 0;
  42. }