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
191 lines
4.6 KiB
C++
191 lines
4.6 KiB
C++
// RUN: %check_clang_tidy %s portability-template-virtual-member-function %t
|
|
namespace UninstantiatedVirtualMember {
|
|
template<typename T>
|
|
struct CrossPlatformError {
|
|
virtual ~CrossPlatformError() = default;
|
|
|
|
static void used() {}
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+1]]:18: warning: unspecified virtual member function instantiation
|
|
virtual void unused() {
|
|
T MSVCError = this;
|
|
};
|
|
};
|
|
|
|
int main() {
|
|
// CHECK-MESSAGES: [[#@LINE+1]]:5: note: template instantiated here
|
|
CrossPlatformError<int>::used();
|
|
return 0;
|
|
}
|
|
} // namespace UninstantiatedVirtualMember
|
|
|
|
namespace UninstantiatedVirtualMembers {
|
|
template<typename T>
|
|
struct CrossPlatformError {
|
|
virtual ~CrossPlatformError() = default;
|
|
|
|
static void used() {}
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:18: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+13]]:5: note: template instantiated here
|
|
virtual void unused() {
|
|
T MSVCError = this;
|
|
};
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:18: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+7]]:5: note: template instantiated here
|
|
virtual void unused2() {
|
|
T MSVCError = this;
|
|
};
|
|
};
|
|
|
|
int main() {
|
|
CrossPlatformError<int>::used();
|
|
return 0;
|
|
}
|
|
} // namespace UninstantiatedVirtualMembers
|
|
|
|
namespace UninstantiatedVirtualDestructor {
|
|
template<typename T>
|
|
struct CrossPlatformError {
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:13: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+9]]:5: note: template instantiated here
|
|
virtual ~CrossPlatformError() {
|
|
T MSVCError = this;
|
|
};
|
|
|
|
static void used() {}
|
|
};
|
|
|
|
int main() {
|
|
CrossPlatformError<int>::used();
|
|
return 0;
|
|
}
|
|
} // namespace UninstantiatedVirtualDestructor
|
|
|
|
namespace MultipleImplicitInstantiations {
|
|
template<typename T>
|
|
struct CrossPlatformError {
|
|
virtual ~CrossPlatformError() = default;
|
|
|
|
static void used() {}
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:18: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+7]]:5: note: template instantiated here
|
|
virtual void unused() {
|
|
T MSVCError = this;
|
|
};
|
|
};
|
|
|
|
int main() {
|
|
CrossPlatformError<int>::used();
|
|
CrossPlatformError<float>::used();
|
|
CrossPlatformError<long>::used();
|
|
return 0;
|
|
}
|
|
} // namespace MultipleImplicitInstantiations
|
|
|
|
namespace SomeImplicitInstantiationError {
|
|
template <typename T> struct CrossPlatformError {
|
|
virtual ~CrossPlatformError() = default;
|
|
|
|
static void used() {}
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:18: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+5]]:5: note: template instantiated here
|
|
virtual void unused(){};
|
|
};
|
|
|
|
int main() {
|
|
CrossPlatformError<int>::used();
|
|
CrossPlatformError<float> NoError;
|
|
return 0;
|
|
}
|
|
} // namespace SomeImplicitInstantiationError
|
|
|
|
namespace InstantiatedVirtualMemberFunctions {
|
|
template<typename T>
|
|
struct NoError {
|
|
virtual ~NoError() {};
|
|
virtual void unused() {};
|
|
virtual void unused2() {};
|
|
virtual void unused3() {};
|
|
};
|
|
|
|
int main() {
|
|
NoError<int> Ne;
|
|
return 0;
|
|
}
|
|
} // namespace InstantiatedVirtualMemberFunctions
|
|
|
|
namespace UninstantiatedNonVirtualMemberFunctions {
|
|
template<typename T>
|
|
struct NoError {
|
|
static void used() {};
|
|
void unused() {};
|
|
void unused2() {};
|
|
void unused3() {};
|
|
};
|
|
|
|
int main() {
|
|
NoError<int>::used();
|
|
return 0;
|
|
}
|
|
} // namespace UninstantiatedNonVirtualMemberFunctions
|
|
|
|
namespace PartialSpecializationError {
|
|
template<typename T, typename U>
|
|
struct CrossPlatformError {};
|
|
|
|
template<typename U>
|
|
struct CrossPlatformError<int, U>{
|
|
virtual ~CrossPlatformError() = default;
|
|
|
|
static void used() {}
|
|
|
|
// CHECK-MESSAGES: [[#@LINE+2]]:18: warning: unspecified virtual member function instantiation
|
|
// CHECK-MESSAGES: [[#@LINE+7]]:5: note: template instantiated here
|
|
virtual void unused() {
|
|
U MSVCError = this;
|
|
};
|
|
};
|
|
|
|
int main() {
|
|
CrossPlatformError<int, float>::used();
|
|
return 0;
|
|
}
|
|
} // namespace PartialSpecializationError
|
|
|
|
namespace PartialSpecializationNoInstantiation {
|
|
template<typename T, typename U>
|
|
struct NoInstantiation {};
|
|
|
|
template<typename U>
|
|
struct NoInstantiation<int, U>{
|
|
virtual ~NoInstantiation() = default;
|
|
|
|
static void used() {}
|
|
|
|
virtual void unused() {
|
|
U MSVCError = this;
|
|
};
|
|
};
|
|
} // namespace PartialSpecializationNoInstantiation
|
|
|
|
namespace PureVirtual {
|
|
|
|
template<typename T>
|
|
struct Base {
|
|
virtual void foo() = 0;
|
|
};
|
|
|
|
struct Derived : public Base<int> {
|
|
void foo() {}
|
|
};
|
|
|
|
void test() {
|
|
Derived{}.foo();
|
|
}
|
|
|
|
}
|