Files
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

108 lines
1.7 KiB
C++

// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -verify %s
// expected-no-diagnostics
typedef __typeof(sizeof(int)) size_t;
void *operator new(size_t, void *h) { return h; }
// I've no idea what this code does, but it used to crash, so let's keep it.
namespace pr37802_v1 {
struct J {
int *p;
};
class X {
void *ar;
public:
X(void *t) : ar(t) {}
template <typename T>
void f(const T &t) {
new (ar) T(t);
}
};
class Y {
public:
template <typename T>
void f(T &&);
void f(J t) {
f(*t.p);
}
};
class Z {
int at() const {}
public:
Z(const Z &other) {
other.au(X(this));
}
template <typename T>
void au(T t) const {
void *c = const_cast<Z *>(this);
if (at()) {
t.f(*static_cast<J *>(c));
} else {
t.f(*static_cast<bool *>(c));
}
}
};
Z g() {
Z az = g();
Z e = az;
Y d;
e.au(d);
}
} // namespace pr37802_v1
// This slightly modified code crashed differently.
namespace pr37802_v2 {
struct J {
int *p;
};
class X {
void *ar;
public:
X(void *t) : ar(t) {}
void f(const J &t) { new (ar) J(t); }
void f(const bool &t) { new (ar) bool(t); }
};
class Y {
public:
void boolf(bool &&);
void f(J &&);
void f(J t) { boolf(*t.p); }
};
class Z {
int at() const {}
public:
Z(const Z &other) { other.au(X(this)); }
void au(X t) const {
void *c = const_cast<Z *>(this);
if (at()) {
t.f(*static_cast<J *>(c));
} else {
t.f(*static_cast<bool *>(c));
}
}
void au(Y t) const {
void *c = const_cast<Z *>(this);
if (at()) {
t.f(*static_cast<J *>(c));
} else {
}
}
};
Z g() {
Z az = g();
Z e = az;
Y d;
e.au(d);
}
} // namespace pr37802_v2