Reputation: 8377
I would like to use libtooling
to test whether the defined by a CXXRecordDecl
is copy constructable.
I have already tried :
hasCopyConstructorWithConstParam()
hasTrivialCopyConstructor() || hasNonTrivialCopyConstructor()
Unfortunately, both of those expressions return true
if the class's copy constructor is implicitly deleted. This can occur if the class inherits from a non-copyable class or has a member variable that is non-copyable.
The logic to test whether a class is copy constructable is non-trivial and must be exist somewhere in clang
. How can I test if a class is copy constructable with libtooling
?
Upvotes: 0
Views: 138
Reputation: 218138
Turn comment into answer:
You can retrieve the constructor with CXXRecordDecl::ctor_begin
and check CXXConstructorDecl::isDeleted()
.
Upvotes: 1