| 1 |
// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 2 |
// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 3 |
// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 4 |
// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 5 |
// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 6 |
// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 7 |
// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 8 |
|
| 9 |
namespace cwg519 { // cwg519: 2.7 |
| 10 |
void f() { |
| 11 |
int *a = 0; |
| 12 |
void *v = a; |
| 13 |
bool c1 = v == static_cast<void *>(0); |
| 14 |
|
| 15 |
void *w = 0; |
| 16 |
int *b = static_cast<int*>(w); |
| 17 |
bool c2 = b == static_cast<int *>(0); |
| 18 |
} |
| 19 |
} // namespace cwg519 |
| 20 |
|
| 21 |
// We're checking that `null`s that were initially stored in `a` and `w` |
| 22 |
// are simply copied over all the way to respective comparisons with `null`. |
| 23 |
|
| 24 |
// CHECK-LABEL: define {{.*}} void @cwg519::f()() |
| 25 |
// CHECK: store ptr null, ptr [[A:%.+]], |
| 26 |
// CHECK-NEXT: [[TEMP_A:%.+]] = load ptr, ptr [[A]] |
| 27 |
// CHECK-NEXT: store ptr [[TEMP_A]], ptr [[V:%.+]], |
| 28 |
// CHECK-NEXT: [[TEMP_V:%.+]] = load ptr, ptr [[V]] |
| 29 |
// CHECK-NEXT: {{.+}} = icmp eq ptr [[TEMP_V]], null |
| 30 |
|
| 31 |
// CHECK: store ptr null, ptr [[W:%.+]], |
| 32 |
// CHECK-NEXT: [[TEMP_W:%.+]] = load ptr, ptr [[W]] |
| 33 |
// CHECK-NEXT: store ptr [[TEMP_W]], ptr [[B:%.+]], |
| 34 |
// CHECK-NEXT: [[TEMP_B:%.+]] = load ptr, ptr [[B]] |
| 35 |
// CHECK-NEXT: {{.+}} = icmp eq ptr [[TEMP_B]], null |
| 36 |
// CHECK-LABEL: } |