deduct.fail.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // <regex>
  9. // UNSUPPORTED: c++98, c++03, c++11, c++14
  10. // UNSUPPORTED: libcpp-no-deduction-guides
  11. // template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
  12. // vector(InputIterator, InputIterator, Allocator = Allocator())
  13. // -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
  14. //
  15. #include <regex>
  16. #include <string>
  17. #include <iterator>
  18. #include <cassert>
  19. #include <cstddef>
  20. int main(int, char**)
  21. {
  22. // Test the explicit deduction guides
  23. {
  24. // basic_regex(ForwardIterator, ForwardIterator)
  25. // <int> is not an iterator
  26. std::basic_regex re(23, 34); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_regex'}}
  27. }
  28. {
  29. // basic_regex(ForwardIterator, ForwardIterator, flag_type)
  30. // <double> is not an iterator
  31. 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'}}
  32. }
  33. // Test the implicit deduction guides
  34. return 0;
  35. }