diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/kext8.C')
-rw-r--r-- | gcc/testsuite/g++.dg/kext8.C | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/kext8.C b/gcc/testsuite/g++.dg/kext8.C new file mode 100644 index 00000000000..399f8c03f44 --- /dev/null +++ b/gcc/testsuite/g++.dg/kext8.C @@ -0,0 +1,36 @@ +/* APPLE LOCAL file KEXT double destructor --bowdidge */ +/* Radar 3943783 kernel extensions built with gcc-4.0 can't be loaded */ +/* { dg-do compile { target powerpc*-apple-darwin* } } */ +/* { dg-options "-S -fapple-kext -fno-exceptions" } */ + +/* Here's some kext class hierarchy code. */ + + +struct Base { + virtual ~Base(); +} __attribute__((apple_kext_compatibility)); + +struct Derived : Base { + void operator delete(void *) { } + Derived(); +}; + +void foo() { + Derived d1; // ok +} + +/* Here's some inlined functions to try to trick the compiler into creating coalesced + sections. */ +inline unsigned f(unsigned n) { return n == 0 ? 0 : n + f(n-1); } + +unsigned g(unsigned n) { return f(n); } + +/* Here's some template stuff to try to trick the compiler into creating coalesced sections + another way. */ + + template <typename X> X ident(X x) { return x; } + int foo(int n) { return ident(n); } + +/* See if there's any sections with the coalesced flag. coalesced sections + currently aren't loaded by the kernel loader into memory. */ +/* { dg-final { scan-assembler-not "coalesced" } } */ |