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
63 lines
2.2 KiB
C++
63 lines
2.2 KiB
C++
// RUN: %clang_cc1 -std=c++14 %s -verify -fms-extensions -triple x86_64-windows-msvc
|
|
// RUN: %clang_cc1 -std=c++17 %s -verify -fms-extensions -triple x86_64-windows-msvc
|
|
|
|
__declspec(dllimport) void imported_func();
|
|
__declspec(dllimport) int imported_int;
|
|
struct Foo {
|
|
void __declspec(dllimport) imported_method();
|
|
};
|
|
|
|
// Instantiation is OK.
|
|
template <void (*FP)()> struct TemplateFnPtr {
|
|
static void getit() { FP(); }
|
|
};
|
|
template <void (&FP)()> struct TemplateFnRef {
|
|
static void getit() { FP(); }
|
|
};
|
|
void instantiate1() {
|
|
TemplateFnPtr<&imported_func>::getit();
|
|
TemplateFnRef<imported_func>::getit();
|
|
}
|
|
|
|
// Check variable template instantiation.
|
|
template <int *GI> struct TemplateIntPtr {
|
|
static int getit() { return *GI; }
|
|
};
|
|
template <int &GI> struct TemplateIntRef {
|
|
static int getit() { return GI; }
|
|
};
|
|
int instantiate2() {
|
|
int r = 0;
|
|
r += TemplateIntPtr<&imported_int>::getit();
|
|
r += TemplateIntRef<imported_int>::getit();
|
|
return r;
|
|
}
|
|
|
|
// Member pointer instantiation.
|
|
template <void (Foo::*MP)()> struct TemplateMemPtr { };
|
|
TemplateMemPtr<&Foo::imported_method> instantiate_mp;
|
|
|
|
// constexpr initialization doesn't work for dllimport things.
|
|
// expected-error@+1{{must be initialized by a constant expression}}
|
|
constexpr void (*constexpr_import_func)() = &imported_func;
|
|
// expected-error@+1{{must be initialized by a constant expression}}
|
|
constexpr int *constexpr_import_int = &imported_int;
|
|
// expected-error@+1{{must be initialized by a constant expression}}
|
|
constexpr void (Foo::*constexpr_memptr)() = &Foo::imported_method;
|
|
|
|
// We make dynamic initializers for 'const' globals, but not constexpr ones.
|
|
void (*const const_import_func)() = &imported_func;
|
|
int *const const_import_int = &imported_int;
|
|
void (Foo::*const const_memptr)() = &Foo::imported_method;
|
|
|
|
// Check that using a non-type template parameter for constexpr global
|
|
// initialization is correctly diagnosed during template instantiation.
|
|
template <void (*FP)()> struct StaticConstexpr {
|
|
// expected-error@+1{{must be initialized by a constant expression}}
|
|
static constexpr void (*g_fp)() = FP;
|
|
};
|
|
void instantiate3() {
|
|
// expected-note@+1 {{requested here}}
|
|
StaticConstexpr<imported_func>::g_fp();
|
|
}
|