我明白问题所在,我只是不确定为什么我没有从gcc获得任何错误输出。gcc 4.7.3使用make_shared与构造函数时出现内部编译器错误
有关其产生问题的线路有:
std::string type,rel,pred;
std::tie(type, rel, pred) = tuple;
auto supertype = std::make_shared<Node>(Token(type)); // This
auto predicate = std::make_shared<Node>(Token(pred)); // and this
仅供参考,节点构造函数是:
Node (Token & token)
如果我这样做,我没有得到任何错误:
auto type_token = Token(type);
auto pred_token = Token(pred);
auto supertype = std::make_shared<Node>(type_token);
auto predicate = std::make_shared<Node>(pred_token);
我的GCC是:
posix gcc version 4.7.3 (Debian 4.7.3-8)
实际的错误是:
> Internal compiler error: Error reporting routines re-entered. Please
> submit a full bug report, with preprocessed source if appropriate. See
> <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
有趣的是,这个目录上面甚至不存在。
在make_shared构造函数中构造一个对象时出现了什么问题?
Ty为答案。出于好奇,这个^^对于临时对象是正确的,但是不是**堆分配对象,例如, std :: make_shared(new Token(foo)),假设构造函数接受一个指针。 http://coliru.stacked-crooked.com/a/f94c856dd5f3800b –
GCC 4.8正确编译这个程序,[喷出大量的错误信息。](http://coliru.stacked-crooked.com/a/777204dbaf03dc45) – Casey
@Alex rvalues对于临时值,函数返回值和左值的'std :: move(...)'的结果是正确的。指针会很好。 – Casey