forked from OSchip/llvm-project
Added more tests for numeric conversion error handing; Refs LWG issue 2009
llvm-svn: 188282
This commit is contained in:
parent
c14b59d1a1
commit
914993df0b
|
@ -86,4 +86,23 @@ int main()
|
|||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
// LWG issue #2009
|
||||
try
|
||||
{
|
||||
std::stol("9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
std::stol(L"9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,4 +98,13 @@ int main()
|
|||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
std::stoll(L"99999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,23 @@ int main()
|
|||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
// LWG issue #2009
|
||||
try
|
||||
{
|
||||
std::stoul("9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
std::stoul(L"9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,4 +85,23 @@ int main()
|
|||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
// LWG issue #2009
|
||||
try
|
||||
{
|
||||
std::stoull("9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
std::stoull(L"9999999999999999999999999999999999999999999999999", &idx);
|
||||
assert(false);
|
||||
}
|
||||
catch (const std::out_of_range&)
|
||||
{
|
||||
assert(idx == 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue