C++ 为什么我没有得到已知的转换错误?

C++ 为什么我没有得到已知的转换错误?,c++,c++11,metaprogramming,std,stdmove,C++,C++11,Metaprogramming,Std,Stdmove,我有这样一个密码: 当我尝试编译它时,我得到了以下结果: ./type_holder.h:45:14: error: no matching constructor for initialization of 'test_class' return new T(args...); ^ ~~~~ ./type_holder.h:54:35: note: in instantiation of member fu

我有这样一个密码:

当我尝试编译它时,我得到了以下结果:

./type_holder.h:45:14: error: no matching constructor for initialization of 'test_class'
                return new T(args...);
                           ^ ~~~~
./type_holder.h:54:35: note: in instantiation of member function 'di::DiConstructor<true, test_class, di::DiMark &&, di::AnyResolver>::construct' requested
      here
                                                         decltype(AnyResolver())>::construct(std::move(DiMark{}), AnyResolver{});
                                                                                   ^
test.cc:26:19: note: in instantiation of function template specialization 'di::ConstructIfPossible<test_class>' requested here
        std::cout << di::ConstructIfPossible<test_class>() << std::endl;
                         ^
test.cc:14:9: note: candidate constructor not viable: no known conversion from 'di::DiMark' to 'di::DiMark &&' for 1st argument
        INJECT(test_class, int* a) {}
               ^
./inject_markers.h:6:36: note: expanded from macro 'INJECT'
#define INJECT(name, ...) explicit name(di::DiMark&& m, __VA_ARGS__)
                                   ^
test.cc:12:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class test_class {
      ^
test.cc:12:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided
1 error generated.
/type\u holder.h:45:14:错误:没有用于初始化“test\u类”的匹配构造函数
返回新的T(参数…);
^ ~~~~
./type_holder.h:54:35:注意:在成员函数'di::DiConstructor::construct'的实例化中请求
在这里
decltype(AnyResolver())>:construct(std::move(DiMark{}),AnyResolver{});
^
test.cc:26:19:注意:在函数模板专门化的实例化中,这里请求了'di::Constructifable'

std::cout错误告诉您的是,您正试图使用双参数构造函数构造一个
test\u类
对象,但尚未定义任何对象

有两个构造函数,都是隐式定义的,它们接受一个参数(复制构造函数和移动构造函数)。但是,由于您试图使用
DiMark
AnyResolver
参数构造
test\u类
对象,并且此构造函数不存在,因此会出现错误


要解决这个问题,您需要创建一个双参数构造函数。(然后您可能需要定义复制和移动构造函数,因为如果您定义任何其他构造函数,将不会定义隐式构造函数。)

如果您可以发布一个,这将非常有用。显示的代码无法满足,没有它就无法完全分析。什么是
test\u class
?更新注释并添加到WandboxPlease的链接在问题中发布问题代码,而不是在非现场链接中,这样当您的非现场链接中断时,问题仍然具有一些可能的价值。我已更新我的问题并发布了复制代码片段的链接。