mercredi 28 septembre 2016

Compile error when building qt 5.7 on Windows with msvc 2013

When I try to build the source code of Qt 5.7, I am getting the following compile error

qnode_p.h(108): error C2955: 'Qt3DCore::QNodePrivate::DestructionFunction' : use of alias template requires template argument list

qnode_p.h(105) : see declaration of 'Qt3DCore::QNodePrivate::DestructionFunction' qscene.cpp

qnode_p.h(108) : error C2955: 'Qt3DCore::QNodePrivate::DestructionFun ction' : use of alias template requires template argument list

qnode_p.h(105) : see declaration of 'Qt3DCore::QNodePrivate::DestructionFunction' Generating Code

It is error C2955 use of alias template requires template argument list.

The source code that is causing the problem is below

class QT3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public    QObservableInterface
{
    public:
   QNodePrivate();
   ~QNodePrivate();
...
   template<typename Caller, typename NodeType>
   using DestructionFunction = void (Caller::*)(NodeType *);

   template<typename Caller, typename NodeType, typename PropertyType>
   void registerDestructionHelper(NodeType *, DestructionFunction<Caller, NodeType>, PropertyType);

   template<typename Caller, typename NodeType>
   void registerDestructionHelper(NodeType *node, DestructionFunction<Caller, NodeType> func, NodeType *&)
   {
      // If the node is destoyed, we make sure not to keep a dangling pointer to it
      auto f = std::bind(func, static_cast<Caller *>(q_func()), nullptr);
      m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f));
   }

   template<typename Caller, typename NodeType>
   void registerDestructionHelper(NodeType *node, DestructionFunction<Caller, NodeType> func, QVector<NodeType*> &)
   {
      // If the node is destoyed, we make sure not to keep a dangling pointer to it
      auto f = std::bind(func, static_cast<Caller *>(q_func()), node);
      m_destructionConnections.insert(node, QObject::connect(node, &QNode::nodeDestroyed, f));
   }

   //....
}

line 105 is using

DestructionFunction = void (Caller::*)(NodeType *);

line 108 is

void registerDestructionHelper(NodeType *, DestructionFunction<Caller, NodeType>, PropertyType);

From what I read about C++11 this should compile ok but for some reason vs 2013 gives the above error.

Aucun commentaire:

Enregistrer un commentaire