diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-27 15:17:06 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-27 15:17:06 +0000 |
| commit | d7279c4c177bca357ef96ff1379fd9bc420bfe83 (patch) | |
| tree | 3558f327a6f9ab59c5d7a06528d84e1560445247 /test/PCH/cxx_exprs.h | |
| parent | be17651f5cd2e94922c1b732bc8589e180698193 (diff) | |
Notes
Diffstat (limited to 'test/PCH/cxx_exprs.h')
| -rw-r--r-- | test/PCH/cxx_exprs.h | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/test/PCH/cxx_exprs.h b/test/PCH/cxx_exprs.h index a871aa201f124..f647922389912 100644 --- a/test/PCH/cxx_exprs.h +++ b/test/PCH/cxx_exprs.h @@ -1,11 +1,12 @@ // Header for PCH test cxx_exprs.cpp + // CXXStaticCastExpr typedef __typeof__(static_cast<void *>(0)) static_cast_result; // CXXDynamicCastExpr -struct Base { virtual void f(); }; -struct Derived : Base { }; +struct Base { Base(int); virtual void f(int x = 492); ~Base(); }; +struct Derived : Base { Derived(); void g(); }; Base *base_ptr; typedef __typeof__(dynamic_cast<Derived *>(base_ptr)) dynamic_cast_result; @@ -27,3 +28,56 @@ const bool false_value = false; // CXXNullPtrLiteralExpr typedef __typeof__(nullptr) cxx_null_ptr_result; + +void foo(Derived *P) { + // CXXMemberCallExpr + P->f(12); +} + + +// 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; + +Derived foo(); + +Derived::Derived() : Base(4) { +} + +void Derived::g() { + // CXXThisExpr + f(2); // Implicit + this->f(1); // Explicit + + // CXXThrowExpr + throw; + throw 42; + + // CXXDefaultArgExpr + f(); + + const Derived &X = foo(); + + // FIXME: How do I make a CXXBindReferenceExpr, CXXConstructExpr? + + int A = int(0.5); // CXXFunctionalCastExpr + A = int(); // CXXZeroInitValueExpr + + new Base(4); // CXXNewExpr + +} + + +// FIXME: The comment on CXXTemporaryObjectExpr is broken, this doesn't make +// one. +struct CtorStruct { CtorStruct(int, float); }; + +CtorStruct create_CtorStruct() { + return CtorStruct(1, 3.14f); // CXXTemporaryObjectExpr +}; + |
