Checking if a class can be copy constructed

Hello,

I’ve been trying to do some code generation using clang (not libclang), and want to find out if a class can be copy constructed.

I’ve tried testing if the copy constructor is deleted, but this does not work well with templates. For example, I have a class that contains a std::vectorstd::unique_ptr, whose copy constructor will apparently fail to instantiate, but doesn’t cause the copy constructors of std::vector or my class to be marked as deleted. Also, isInvalidDecl() returns false, which (I think) means that the compiler didn’t even attempt to instantiate the constructor as it has never been used.

I believe that my best bet is to try to manually check if the constructor can instantiate. I’ve looked at clang::Sema, but was overwhelmed by the large amount of functions. I also noticed that a lot of these functions seem to have side effects, which is undesired since I do not want this check to cause other parts of the code to not compile.

Am I on the right path? If so, which functions in clang::Sema should I use, and how? If not, is there a better way?

Thank you very much.