38 lines · cpp
1// REQUIRES: crt2 3// RUN: %clangxx -g -fno-exceptions -DCRT_SHARED -c %s -fPIC -o %tshared.o4// RUN: %clangxx -g -fno-exceptions -c %s -fPIC -o %t.o5// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %crtbegin %tshared.o %libstdcxx %libc -lm %libgcc %crtend %crtn6// RUN: %clangxx -g -o %t -fno-pic -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx %libc -lm %libgcc %t.so %crtend %crtn7// RUN: %run %t 2>&1 | FileCheck %s8 9// UNSUPPORTED: target={{(arm|aarch64).*}}10 11#include <stdio.h>12 13// CHECK: 114// CHECK-NEXT: ~A()15 16#ifdef CRT_SHARED17bool G;18void C() {19 printf("%d\n", G);20}21 22struct A {23 A() { G = true; }24 ~A() {25 printf("~A()\n");26 }27};28 29A a;30#else31void C();32 33int main() {34 C();35 return 0;36}37#endif38