libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test bad_cast
|
||||
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::exception, std::bad_cast>::value),
|
||||
"std::is_base_of<std::exception, std::bad_cast>::value");
|
||||
static_assert(std::is_polymorphic<std::bad_cast>::value,
|
||||
"std::is_polymorphic<std::bad_cast>::value");
|
||||
std::bad_cast b;
|
||||
std::bad_cast b2 = b;
|
||||
b2 = b;
|
||||
const char* w = b2.what();
|
||||
assert(w);
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test bad_typeid
|
||||
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::exception, std::bad_typeid>::value),
|
||||
"std::is_base_of<std::exception, std::bad_typeid>::value");
|
||||
static_assert(std::is_polymorphic<std::bad_typeid>::value,
|
||||
"std::is_polymorphic<std::bad_typeid>::value");
|
||||
std::bad_typeid b;
|
||||
std::bad_typeid b2 = b;
|
||||
b2 = b;
|
||||
const char* w = b2.what();
|
||||
assert(w);
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test type_info
|
||||
|
||||
#include <typeinfo>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::type_info& t1 = typeid(int);
|
||||
const std::type_info& t2 = typeid(int);
|
||||
assert(t1 == t2);
|
||||
const std::type_info& t3 = typeid(short);
|
||||
assert(t1 != t3);
|
||||
assert(!t1.before(t2));
|
||||
assert(strcmp(t1.name(), t2.name()) == 0);
|
||||
assert(strcmp(t1.name(), t3.name()) != 0);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test type_info
|
||||
|
||||
#include <typeinfo>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::type_info& t1 = typeid(int);
|
||||
const std::type_info& t2 = typeid(int);
|
||||
const std::type_info& t3 = typeid(short);
|
||||
assert(t1.hash_code() == t2.hash_code());
|
||||
assert(t1.hash_code() != t3.hash_code());
|
||||
}
|
20
test/language.support/support.rtti/version.pass.cpp
Normal file
20
test/language.support/support.rtti/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <typeinfo>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user