Home | History | Annotate | Download | only in drs
      1 // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
      2 // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
      3 // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
      4 // RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
      5 
      6 // dr1748: 3.7
      7 
      8 // FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
      9 __extension__ typedef __SIZE_TYPE__ size_t;
     10 
     11 void *operator new(size_t, void *);
     12 void *operator new[](size_t, void *);
     13 
     14 struct X { X(); };
     15 
     16 // The reserved placement allocation functions get inlined
     17 // even if we can't see their definitions. They do not
     18 // perform a null check.
     19 
     20 // CHECK-LABEL: define {{.*}} @_Z1fPv(
     21 // CHECK-NOT: call
     22 // CHECK-NOT: icmp{{.*}} null
     23 // CHECK-NOT: br i1
     24 // CHECK: call void @_ZN1XC1Ev(
     25 // CHECK: }
     26 X *f(void *p) { return new (p) X; }
     27 
     28 // CHECK-LABEL: define {{.*}} @_Z1gPv(
     29 // CHECK-NOT: call
     30 // CHECK-NOT: icmp{{.*}} null
     31 // CHECK-NOT: br i1
     32 // CHECK: call void @_ZN1XC1Ev(
     33 // CHECK: br i1
     34 // CHECK: }
     35 X *g(void *p) { return new (p) X[5]; }
     36