xref: /llvm-project/clang/test/CXX/drs/cwg658.cpp (revision ed128c7df9b4e60bfd814dc9fd22de1dde4a2c1c)
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 cwg658 { // cwg658: 2.7
10 
f(int * p1)11 void f(int* p1) {
12   char* p2 = reinterpret_cast<char*>(p1);
13 }
14 
15 } // namespace cwg658
16 
17 // We're checking that p1 is stored into p2 without changes.
18 
19 // CHECK-LABEL: define {{.*}} void @cwg658::f(int*)(ptr noundef %p1)
20 // CHECK:         [[P1_ADDR:%.+]] = alloca ptr, align 8
21 // CHECK-NEXT:    [[P2:%.+]] = alloca ptr, align 8
22 // CHECK:         store ptr %p1, ptr [[P1_ADDR]]
23 // CHECK-NEXT:    [[TEMP:%.+]] = load ptr, ptr [[P1_ADDR]]
24 // CHECK-NEXT:    store ptr [[TEMP]], ptr [[P2]]
25 // CHECK-LABEL: }
26