11efbe674SMarshall Clow //===----------------------------------------------------------------------===// 21efbe674SMarshall Clow // 31efbe674SMarshall Clow // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41efbe674SMarshall Clow // See https://llvm.org/LICENSE.txt for license information. 51efbe674SMarshall Clow // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61efbe674SMarshall Clow // 71efbe674SMarshall Clow //===----------------------------------------------------------------------===// 81efbe674SMarshall Clow 9*8c61114cSLouis Dionne // UNSUPPORTED: no-exceptions 101efbe674SMarshall Clow // <regex> 111efbe674SMarshall Clow 121efbe674SMarshall Clow // template <class charT, class traits = regex_traits<charT>> class basic_regex; 131efbe674SMarshall Clow 141efbe674SMarshall Clow // template <class ST, class SA> 151efbe674SMarshall Clow // basic_regex(const basic_string<charT, ST, SA>& s); 161efbe674SMarshall Clow 171efbe674SMarshall Clow #include <regex> 181efbe674SMarshall Clow #include <cassert> 191efbe674SMarshall Clow #include "test_macros.h" 201efbe674SMarshall Clow error_range_thrown(const char * pat)211efbe674SMarshall Clowstatic bool error_range_thrown(const char *pat) 221efbe674SMarshall Clow { 231efbe674SMarshall Clow bool result = false; 241efbe674SMarshall Clow try { 251efbe674SMarshall Clow std::regex re(pat); 261efbe674SMarshall Clow } catch (const std::regex_error &ex) { 271efbe674SMarshall Clow result = (ex.code() == std::regex_constants::error_range); 281efbe674SMarshall Clow } 291efbe674SMarshall Clow return result; 301efbe674SMarshall Clow } 311efbe674SMarshall Clow main(int,char **)321efbe674SMarshall Clowint main(int, char**) 331efbe674SMarshall Clow { 3441d5fdfaSMarshall Clow assert(error_range_thrown("([\\w-a])")); 3541d5fdfaSMarshall Clow assert(error_range_thrown("([a-\\w])")); 361efbe674SMarshall Clow 371efbe674SMarshall Clow return 0; 381efbe674SMarshall Clow } 39