alloc.fail.cpp 959 B

123456789101112131415161718192021222324252627282930313233
  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. // UNSUPPORTED: c++98, c++03
  9. // <tuple>
  10. // template <class... Types> class tuple;
  11. // template <class Alloc>
  12. // explicit(see-below) tuple(allocator_arg_t, const Alloc& a);
  13. // Make sure we get the explicit-ness of the constructor right.
  14. // This is LWG 3158.
  15. #include <tuple>
  16. #include <memory>
  17. struct ExplicitDefault { explicit ExplicitDefault() { } };
  18. std::tuple<ExplicitDefault> explicit_default_test() {
  19. return {std::allocator_arg, std::allocator<int>()}; // expected-error {{chosen constructor is explicit in copy-initialization}}
  20. }
  21. int main(int, char**) {
  22. return 0;
  23. }