mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 03:36:07 +00:00

This patch implements P0848 in Clang. During the instantiation of a C++ class, in `Sema::ActOnFields`, we evaluate constraints for all the SMFs and compare the constraints to compute the eligibility. We defer the computation of the type's [copy-]trivial bits from addedMember to the eligibility computation, like we did for destructors in D126194. `canPassInRegisters` is modified as well to better respect the ineligibility of functions. Note: Because of the non-implementation of DR1734 and DR1496, I treat deleted member functions as 'eligible' for the purpose of [copy-]triviallity. This is unfortunate, but I couldn't think of a way to make this make sense otherwise. Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman Differential Revision: https://reviews.llvm.org/D128619
16 lines
547 B
C++
16 lines
547 B
C++
// RUN: %clang_cc1 -std=c++20 -triple x86_64-pc-linux %s -ast-dump | FileCheck %s
|
|
// RUN: %clang_cc1 -std=c++20 -triple x86_64-pc-win32 %s -ast-dump | FileCheck %s
|
|
|
|
template<class X>
|
|
struct DefaultConstructibleWithTemplate {
|
|
template<class T = int>
|
|
DefaultConstructibleWithTemplate();
|
|
};
|
|
|
|
void f() {
|
|
DefaultConstructibleWithTemplate<int> x;
|
|
}
|
|
|
|
// CHECK: | `-ClassTemplateSpecializationDecl {{.*}} struct DefaultConstructibleWithTemplate definition
|
|
// CHECK: | | |-CXXConstructorDecl {{.*}} DefaultConstructibleWithTemplate 'void ()'
|