0

テンプレート クラスを継承し、"using" を使用してそのコンストラクターを継承したいと考えています。しかし、移動コンストラクターを呼び出すと、「一致するコンストラクターがありません」で失敗します

#include <iostream>

template <typename ARG>
class TBase {
 public:
  TBase() {}
  TBase(TBase<ARG>&& t) {}

 private:
  ARG arg;
};

class Int : public TBase<int> {
 public:
  using TBase<int>::TBase;
};

int main() {
  TBase<int> t1;
  Int t2(std::move(t1));
  return 0;
}

ビルド結果

 In function 'int main()':
20:23: error: no matching function for call to 'Int::Int(std::remove_reference<TBase<int>&>::type)'
20:23: note: candidates are:
13:7: note: Int::Int()
13:7: note:   candidate expects 0 arguments, 1 provided
13:7: note: Int::Int(Int&&)
13:7: note:   no known conversion for argument 1 from 'std::remove_reference<TBase<int>&>::type {aka TBase<int>}' to 'Int&&'
4

1 に答える 1