deduct.fail.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <regex>
  10. // UNSUPPORTED: c++98, c++03, c++11, c++14
  11. // UNSUPPORTED: libcpp-no-deduction-guides
  12. // template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
  13. // vector(InputIterator, InputIterator, Allocator = Allocator())
  14. // -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
  15. //
  16. #include <regex>
  17. #include <string>
  18. #include <iterator>
  19. #include <cassert>
  20. #include <cstddef>
  21. int main()
  22. {
  23. // Test the explicit deduction guides
  24. {
  25. // basic_regex(ForwardIterator, ForwardIterator)
  26. // <int> is not an iterator
  27. std::basic_regex re(23, 34); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_regex'}}
  28. }
  29. {
  30. // basic_regex(ForwardIterator, ForwardIterator, flag_type)
  31. // <double> is not an iterator
  32. std::basic_regex re(23.0, 34.0, std::regex_constants::basic); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_regex'}}
  33. }
  34. // Test the implicit deduction guides
  35. }