37 lines · cpp
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 CHECK2// 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 CHECK3// 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 CHECK4// 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 CHECK5// 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 CHECK6// 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 CHECK7// 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 CHECK8 9namespace cwg519 { // cwg519: 2.710void 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 cwg51920 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]], null30 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]], null36// CHECK-LABEL: }37