Index: include/regex =================================================================== --- include/regex +++ include/regex @@ -4013,7 +4013,7 @@ char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase); if (__class_type == 0) - __throw_regex_error(); + __throw_regex_error(); __ml->__add_class(__class_type); __first = _VSTD::next(__temp, 2); return __first; Index: test/std/re/re.regex/re.regex.construct/bad_ctype.pass.cpp =================================================================== --- test/std/re/re.regex/re.regex.construct/bad_ctype.pass.cpp +++ test/std/re/re.regex/re.regex.construct/bad_ctype.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-no-exceptions +// + +// template > class basic_regex; + +// template +// basic_regex(const basic_string& s); + +#include +#include +#include "test_macros.h" + +static bool error_ctype_thrown(const char *pat) +{ + bool result = false; + try { + std::regex re(pat); + } catch (const std::regex_error &ex) { + result = (ex.code() == std::regex_constants::error_ctype); + } + return result; +} + +int main() +{ + assert(error_ctype_thrown("[[::]]")); + assert(error_ctype_thrown("[[:error:]]")); +}