(c++11) is_trivially_copy_constructible always false if class has destructor

(c++11) is_trivially_copy_constructible always false if class has destructor

Hi, when some class (T) has destructor is_trivially_copy_constructible<T>::value is always false.

For example:

//trivially copy constructable class with destructor
class CSomeClass {
public:
	int x;

	//explicitly specify default copy constructor
	CSomeClass(const CSomeClass&) = default;

	//non-default destructor
	~CSomeClass(){
	}
};

//all asserts below are failed
static_assert(is_trivially_copy_constructible<CSomeClass>::value, "not a trivially copy constructable"); 
static_assert(is_trivially_move_constructible<CSomeClass>::value, "not a trivially move constructable");
static_assert(is_trivially_constructible<CSomeClass, const CSomeClass&>::value,  "not a trivially copy constructable");
static_assert(is_trivially_constructible<CSomeClass, CSomeClass&&>::value, "not a trivially copy constructable");

If we remove destructor, all assertion will pass.

According C++11 specification (in my case I refer to draft n3376), is_trivially_copy_constructible<T> should be true when is_copy_constructible<T> is true and only trivial operations are involved.

So I think is_trivially_copy_constructible should be true in the above example.

I have installed the following compiler: Intel® C++ Composer XE 2015   Package ID : w_ccompxe_2015.0.030, for Microsoft* Visual Studio* 2013.

Btw, with ms vc120 compiler, all asserts are pass.

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Best Reply

Hi Andrey,

I can reproduce the issue, I will track the issue in our problem tracking system. Hope to see it fixed (implemented) in future.

Note: This C++11 feature is even not supported by latest gcc 4.9.0 and ICC 15.0 Linux version.

Thanks,

Shenghong

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui