llvm-project/clang/test/PCH/cxx_exprs.h

55 lines
1.3 KiB
C
Raw Normal View History

// Header for PCH test cxx_exprs.cpp
2010-05-09 06:03:39 +00:00
// CXXStaticCastExpr
2010-02-07 06:32:43 +00:00
typedef __typeof__(static_cast<void *>(0)) static_cast_result;
// CXXDynamicCastExpr
struct Base { virtual void f(); };
struct Derived : Base { void g(); };
Base *base_ptr;
2010-02-07 06:32:43 +00:00
typedef __typeof__(dynamic_cast<Derived *>(base_ptr)) dynamic_cast_result;
// CXXReinterpretCastExpr
2010-02-07 06:32:43 +00:00
typedef __typeof__(reinterpret_cast<void *>(0)) reinterpret_cast_result;
// CXXConstCastExpr
const char *const_char_ptr_value;
2010-02-07 06:32:43 +00:00
typedef __typeof__(const_cast<char *>(const_char_ptr_value)) const_cast_result;
// CXXFunctionalCastExpr
int int_value;
2010-02-07 06:32:43 +00:00
typedef __typeof__(double(int_value)) functional_cast_result;
// CXXBoolLiteralExpr
typedef __typeof__(true) bool_literal_result;
const bool true_value = true;
const bool false_value = false;
// CXXNullPtrLiteralExpr
typedef __typeof__(nullptr) cxx_null_ptr_result;
void foo(Derived *P) {
// CXXMemberCallExpr
P->f();
2010-05-09 06:03:39 +00:00
}
// FIXME: This is a hack until <typeinfo> works completely.
namespace std {
class type_info {};
}
// CXXTypeidExpr - Both expr and type forms.
typedef __typeof__(typeid(int))* typeid_result1;
typedef __typeof__(typeid(2))* typeid_result2;
void Derived::g() {
// CXXThisExpr
f(); // Implicit
this->f(); // Explicit
// CXXThrowExpr
throw;
throw 42;
}