Search code examples
c++visual-c++compiler-errorsvariadic-templatesiar

Argument list for class template is missing, but not with VisualC++


With IAR compiler, I have the following error: Argument list for class template "CallbackInterface" is missing But with VisualC++, it compiles like a charm.

What could explain it?

Heres is my callback interface

template<typename DataModel, typename... ArgumentType>
class CallbackInterface : public DataModel
{
public:
    CallbackInterface() {};
    ~CallbackInterface() {};
    CallbackInterface(ArgumentType... arg) : DataModel(arg...) {};

protected:
    ///Callback methods
    static bool AlwaysDisplayable(DataModel* baseInstance) { return true; };
};

Here's my specialization for this interface:

template<typename DataModel, typename... ArgumentType>
class ThisCallbackInterface : public CallbackInterface<DataModel, ArgumentType...>
{
public:
    ThisCallbackInterface() {};
    ~ThisCallbackInterface() {};
    ThisCallbackInterface(ArgumentType... arg) : CallbackInterface(arg...) {};

And my final child class:

using DataType = Something;

struct DataModel 
{
  DataModel(){};
  DataModel(DataType dataArgs){};
};

class Child: public CallbackStore<DataModel>, public ThisCallbackInterface<DataModel,DataType>
{
public:
    Child(DataType dataArgs) : 
        CallbackStore(this),
        ThisCallbackInterface(dataArgs){};
    Child():
        CallbackStore(nullptr),
        ThisCallbackInterface(){};
    ~Child(){};
};

Solution

  • Maybe explicating the template parameters of CallbackInterface ?

      ThisCallbackInterface(ArgumentType... arg)
         : CallbackInterface<DataModel, ArgumentType...>(arg...)
       { } // ..............^^^^^^^^^^^^^^^^^^^^^^^^^^^^