1 // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
5
6 // dr158: yes
7
8 // CHECK-LABEL: define {{.*}} @_Z1f
f(const int * const * p,int ** q)9 const int *f(const int * const *p, int **q) {
10 // CHECK: load i32**, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]]
11 const int *x = *p;
12 // CHECK: store i32* null, {{.*}}, !tbaa ![[INTPTR_TBAA]]
13 *q = 0;
14 return x;
15 }
16
17 struct A {};
18
19 // CHECK-LABEL: define {{.*}} @_Z1g
__anon6edce51a0102null20 const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] {
21 // CHECK: load i64**, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]]
22 const int *(A::*const *x)[3] = *p;
23 // CHECK: store i64* null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
24 *q = 0;
25 return x;
26 }
27
28