Files
TheRock/compiler/amd-llvm/clang/test/CodeGenCXX/meminit-initializers-odr.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

141 lines
2.6 KiB
C++

// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - | FileCheck %s
struct ThisShouldBeCalled {
ThisShouldBeCalled() {}
};
template <typename T>
struct ThisShouldBeCalledTPL {
ThisShouldBeCalledTPL() {}
};
consteval int f () {
return 42;
}
struct WithConsteval {
WithConsteval(int x = f()) {}
};
template <typename T>
struct WithConstevalTPL {
WithConstevalTPL(T x = f()) {}
};
struct Base {
ThisShouldBeCalled y = {};
};
struct S : Base {
ThisShouldBeCalledTPL<int> A = {};
WithConsteval B = {};
WithConstevalTPL<double> C = {};
};
void Do(S = S{}) {}
void test() {
Do();
}
// CHECK-LABEL: @_ZN18ThisShouldBeCalledC2Ev
// CHECK-LABEL: @_ZN21ThisShouldBeCalledTPLIiEC2Ev
// CHECK-LABEL: @_ZN13WithConstevalC2Ei
// CHECK-LABEL: @_ZN16WithConstevalTPLIdEC2Ed
namespace check_arrays {
template <typename T>
struct inner {
inner() {}
};
struct S {
inner<int> a {};
};
class C {
S s[1]{};
};
int f() {
C c;
return 0;
}
// CHECK-LABEL: @_ZN12check_arrays5innerIiEC2Ev
}
namespace check_field_inits_in_base_constructors {
template <typename>
struct ShouldBeODRUsed {
ShouldBeODRUsed() {}
};
class k {
// The private here is important,
// otherwise it would be aggregate initialized.
private:
ShouldBeODRUsed<k> a = {};
};
struct b {
k c{};
};
void test() { b d; }
// CHECK-LABEL: @_ZN38check_field_inits_in_base_constructors15ShouldBeODRUsedINS_1kEEC2Ev
}
namespace check_referenced_when_defined_in_default_parameter {
template <typename T>
struct Test {
Test(auto&&) {}
};
struct Options {
Test<bool(bool x)> identity = [](bool x) -> bool { return x; };
};
struct Wrapper {
Wrapper(const Options& options = Options());
};
void Func() { Options options; }
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter7OptionsC2Ev
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter4TestIFbbEEC1INS_7Options8identityMUlbE_EEEOT_
// CHECK-LABEL: @_ZN50check_referenced_when_defined_in_default_parameter4TestIFbbEEC2INS_7Options8identityMUlbE_EEEOT_
}
namespace lambda_body {
template <typename a>
int templated_func() {
return 0;
}
struct test_body {
int mem = templated_func<int>();
};
struct test_capture {
int mem = templated_func<double>();
};
struct S {
int a = [_ = test_capture{}] { (void)test_body{}; return 0;}();
};
void test() {
S s;
}
// CHECK-LABEL: define{{.*}} @_ZN11lambda_body14templated_funcIdEEiv
// CHECK-LABEL: define{{.*}} @_ZNK11lambda_body1S1aMUlvE_clEv
// CHECK-LABEL: define{{.*}} @_ZN11lambda_body14templated_funcIiEEiv
}