//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template > class basic_regex; // template // basic_regex(const basic_string& s); #include #include int main() { // Correct: Exception thrown for invalid escape char in a character class try { std::regex char_class_escape("[\\a]"); assert(false); } catch (std::regex_error &ex) { assert(ex.code() == std::regex_constants::error_escape); } // Failure: No exception thrown for invalid escape char in this case. try { std::regex escape("\\a"); assert(false); } catch (std::regex_error &ex) { assert(ex.code() == std::regex_constants::error_escape); } }