lundi 7 octobre 2019

Compilation of std::make_shared on final subclass fails in type_traits::__is_empty1 using libcxx lib

final_class is defined as :

class final_class final : private A {
public :
final_class() : A () {};
};

I am using final_class constructor as :

auto a = std::make_shared<final_class>();

And tring to compile using libcxx and -std=c++11 fails to build with following error :

libcxx/include/type_traits:957:8: error: cannot derive from 'final' base 'final_class' in derived type 'std::__1::__is_empty1<final_class>'  struct __is_empty1

As I understand, It tries to derive from its parameters to determine whether or not a class is the virtual base of another class. Previously it worked before final introduction in C++.

Is there a way to fix it?

Aucun commentaire:

Enregistrer un commentaire