diff options
Diffstat (limited to 'test/FrontendC++')
88 files changed, 1656 insertions, 0 deletions
diff --git a/test/FrontendC++/2003-08-20-ExceptionFail.cpp b/test/FrontendC++/2003-08-20-ExceptionFail.cpp new file mode 100644 index 0000000000..fd1c6ad4c2 --- /dev/null +++ b/test/FrontendC++/2003-08-20-ExceptionFail.cpp @@ -0,0 +1,12 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +void foo(); + +void bar() { + struct local { + ~local() { foo(); } + } local_obj; + + foo(); +} + diff --git a/test/FrontendC++/2003-08-21-EmptyClass.cpp b/test/FrontendC++/2003-08-21-EmptyClass.cpp new file mode 100644 index 0000000000..2f90b3a105 --- /dev/null +++ b/test/FrontendC++/2003-08-21-EmptyClass.cpp @@ -0,0 +1,9 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// This tests compilation of EMPTY_CLASS_EXPR's + +struct empty {}; + +void foo(empty) {} + +void bar() { foo(empty()); } diff --git a/test/FrontendC++/2003-08-24-Cleanup.cpp b/test/FrontendC++/2003-08-24-Cleanup.cpp new file mode 100644 index 0000000000..ab0d1a0d11 --- /dev/null +++ b/test/FrontendC++/2003-08-24-Cleanup.cpp @@ -0,0 +1,10 @@ +// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep unwind + +struct S { ~S(); }; + +int mightthrow(); + +int test() { + S s; + mightthrow(); +} diff --git a/test/FrontendC++/2003-08-27-TypeNamespaces.cpp b/test/FrontendC++/2003-08-27-TypeNamespaces.cpp new file mode 100644 index 0000000000..cd7247e608 --- /dev/null +++ b/test/FrontendC++/2003-08-27-TypeNamespaces.cpp @@ -0,0 +1,16 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + +namespace foo { + namespace bar { + struct X { X(); }; + + X::X() {} + } +} + + +namespace { + struct Y { Y(); }; + Y::Y() {} +} diff --git a/test/FrontendC++/2003-08-28-ForwardType.cpp b/test/FrontendC++/2003-08-28-ForwardType.cpp new file mode 100644 index 0000000000..38c4e2d84a --- /dev/null +++ b/test/FrontendC++/2003-08-28-ForwardType.cpp @@ -0,0 +1,23 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// Default placement versions of operator new. +#include <new> + +void* operator new(size_t, void* __p) throw(); + + +template<typename _CharT> +struct stdio_filebuf +{ stdio_filebuf(); + +}; + +extern stdio_filebuf<char> buf_cout; + +void foo() { + // Create stream buffers for the standard streams and use + // those buffers without destroying and recreating the + // streams. + new (&buf_cout) stdio_filebuf<char>(); + +} diff --git a/test/FrontendC++/2003-08-28-SaveExprBug.cpp b/test/FrontendC++/2003-08-28-SaveExprBug.cpp new file mode 100644 index 0000000000..2be35d8d52 --- /dev/null +++ b/test/FrontendC++/2003-08-28-SaveExprBug.cpp @@ -0,0 +1,24 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + +char* eback(); + +template<typename foo> +struct basic_filebuf { + char *instancevar; + + void callee() { + instancevar += eback() != eback(); + } + + void caller(); +}; + + +template<typename _CharT> +void basic_filebuf<_CharT>::caller() { + callee(); +} + + +template class basic_filebuf<char>; diff --git a/test/FrontendC++/2003-08-29-ArgPassingBug.cpp b/test/FrontendC++/2003-08-29-ArgPassingBug.cpp new file mode 100644 index 0000000000..d4cddff314 --- /dev/null +++ b/test/FrontendC++/2003-08-29-ArgPassingBug.cpp @@ -0,0 +1,13 @@ + +// RUN: %llvmgcc -xc++ -c -o /dev/null %s |& not grep WARNING + +struct iterator { + iterator(); + iterator(const iterator &I); +}; + +iterator foo(const iterator &I) { return I; } + +void test() { + foo(iterator()); +} diff --git a/test/FrontendC++/2003-08-31-StructLayout.cpp b/test/FrontendC++/2003-08-31-StructLayout.cpp new file mode 100644 index 0000000000..99d6682662 --- /dev/null +++ b/test/FrontendC++/2003-08-31-StructLayout.cpp @@ -0,0 +1,16 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// There is a HOLE in the derived2 object due to not wanting to place the two +// baseclass instances at the same offset! + +struct baseclass {}; + +class derived1 : public baseclass { + void * NodePtr; +}; + +class derived2 : public baseclass { + derived1 current; +}; + +derived2 RI; diff --git a/test/FrontendC++/2003-09-22-CompositeExprValue.cpp b/test/FrontendC++/2003-09-22-CompositeExprValue.cpp new file mode 100644 index 0000000000..a8208adc51 --- /dev/null +++ b/test/FrontendC++/2003-09-22-CompositeExprValue.cpp @@ -0,0 +1,11 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +struct duration { + duration operator/=(int c) { + return *this; + } +}; + +void a000090() { + duration() /= 1; +} diff --git a/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp b/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp new file mode 100644 index 0000000000..4873123d12 --- /dev/null +++ b/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp @@ -0,0 +1,17 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// Non-POD classes cannot be passed into a function by component, because their +// dtors must be run. Instead, pass them in by reference. The C++ front-end +// was mistakenly "thinking" that 'foo' took a structure by component. + +struct C { + int A, B; + ~C() {} +}; + +void foo(C b); + +void test(C *P) { + foo(*P); +} + diff --git a/test/FrontendC++/2003-09-30-CommaExprBug.cpp b/test/FrontendC++/2003-09-30-CommaExprBug.cpp new file mode 100644 index 0000000000..afe470cd11 --- /dev/null +++ b/test/FrontendC++/2003-09-30-CommaExprBug.cpp @@ -0,0 +1,10 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +class Empty {}; + +void foo(Empty E); + +void bar() { + foo(Empty()); +} + diff --git a/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp b/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp new file mode 100644 index 0000000000..40c9c87ae1 --- /dev/null +++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp @@ -0,0 +1,10 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +struct C {}; + +C &foo(); + +void foox() { + for (; ; foo()); +} + diff --git a/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp b/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp new file mode 100644 index 0000000000..e07eb425d2 --- /dev/null +++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp @@ -0,0 +1,12 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// Test with an opaque type + +struct C; + +C &foo(); + +void foox() { + for (; ; foo()); +} + diff --git a/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp b/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp new file mode 100644 index 0000000000..b1c54b89d5 --- /dev/null +++ b/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp @@ -0,0 +1,12 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +// The C++ front-end thinks the two foo's are different, the LLVM emitter +// thinks they are the same. The disconnect causes problems. + +void foo() { } + +void bar() { + void foo(); + + foo(); +} diff --git a/test/FrontendC++/2003-10-17-BoolBitfields.cpp b/test/FrontendC++/2003-10-17-BoolBitfields.cpp new file mode 100644 index 0000000000..547a367d34 --- /dev/null +++ b/test/FrontendC++/2003-10-17-BoolBitfields.cpp @@ -0,0 +1,11 @@ +// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + +struct test { + bool A : 1; + bool B : 1; +}; + +void foo(test *T) { + T->B = true; +} + diff --git a/test/FrontendC++/2003-10-21-InnerClass.cpp b/test/FrontendC++/2003-10-21-InnerClass.cpp new file mode 100644 index 0000000000..fadd51d226 --- /dev/null +++ b/test/FrontendC++/2003-10-21-InnerClass.cpp @@ -0,0 +1,12 @@ |