Files
TheRock/compiler/amd-llvm/clang/test/CodeGenCXX/ptr-to-datamember.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

100 lines
1.5 KiB
C++

// RUN: %clang_cc1 -emit-llvm -o - %s
extern "C" int printf(...);
struct F {
F() : iF(1), fF(2.0) {}
int iF;
float fF;
};
struct V {
double d;
int iV;
};
struct B : virtual V{
double d;
int iB;
};
struct B1 : virtual V{
double d;
int iB1;
};
class A : public B, public B1 {
public:
A() : f(1.0), d(2.0), Ai(3) {}
float f;
double d;
int Ai;
F Af;
};
template <typename T> struct TT {
int T::t::*pti;
};
struct I {
typedef I t;
int x;
};
void pr(const F& b) {
printf(" %d %f\n", b.iF, b.fF);
}
void test_aggr_pdata(A& a1) {
F A::* af = &A::Af;
pr(a1.*af);
(a1.*af).iF = 100;
(a1.*af).fF = 200.00;
printf(" %d %f\n", (a1.*af).iF, (a1.*af).fF);
pr(a1.*af);
(a1.*af).iF++;
(a1.*af).fF--;
--(a1.*af).fF;
pr(a1.*af);
}
void test_aggr_pdata_1(A* pa) {
F A::* af = &A::Af;
pr(pa->*af);
(pa->*af).iF = 100;
(pa->*af).fF = 200.00;
printf(" %d %f\n", (pa->*af).iF, (pa->*af).fF);
pr(pa->*af);
(pa->*af).iF++;
(pa->*af).fF--;
--(pa->*af).fF;
pr(pa->*af);
}
int main()
{
A a1;
TT<I> tt;
I i;
int A::* pa = &A::Ai;
float A::* pf = &A::f;
double A::* pd = &A::d;
tt.pti = &I::x;
printf("%d %d %d\n", &A::Ai, &A::f, &A::d);
printf("%d\n", &A::B::iB);
printf("%d\n", &A::B1::iB1);
printf("%d\n", &A::f);
printf("%d\n", &A::B::iV);
printf("%d\n", &A::B1::iV);
printf("%d\n", &A::B::V::iV);
printf("%d\n", &A::B1::V::iV);
printf("%d, %f, %f \n", a1.*pa, a1.*pf, a1.*pd);
printf("%d\n", i.*tt.pti);
test_aggr_pdata(a1);
test_aggr_pdata_1(&a1);
}