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