Merge to upstream r225300.

Change-Id: I2b23715db9ac129ff80aa78ad5824db0a4d6fbb3
This commit is contained in:
Dan Albert
2015-01-06 15:06:45 -08:00
parent 4385cd8d93
commit 06086258d3
4853 changed files with 3744 additions and 971 deletions

View File

@@ -0,0 +1,42 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// test invalid_argument
#include <stdexcept>
#include <type_traits>
#include <cstring>
#include <string>
#include <cassert>
int main()
{
static_assert((std::is_base_of<std::logic_error, std::invalid_argument>::value),
"std::is_base_of<std::logic_error, std::invalid_argument>::value");
static_assert(std::is_polymorphic<std::invalid_argument>::value,
"std::is_polymorphic<std::invalid_argument>::value");
{
const char* msg = "invalid_argument message";
std::invalid_argument e(msg);
assert(std::strcmp(e.what(), msg) == 0);
std::invalid_argument e2(e);
assert(std::strcmp(e2.what(), msg) == 0);
e2 = e;
assert(std::strcmp(e2.what(), msg) == 0);
}
{
std::string msg("another invalid_argument message");
std::invalid_argument e(msg);
assert(e.what() == msg);
std::invalid_argument e2(e);
assert(e2.what() == msg);
e2 = e;
assert(e2.what() == msg);
}
}