문제가있는 곳을 이해합니다. 왜 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
참고로, 노드의 ctor는 다음과 같습니다
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);
:
Node (Token & 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 (새 토큰 (foo)). 생성자가 포인터를 허용한다고 가정합니다. http://coliru.stacked-crooked.com/a/f94c856dd5f3800b –
GCC 4.8은이 프로그램을 올바르게 컴파일하고 [많은 오류 메시지를 내뿜습니다.] (http://coliru.stacked-crooked.com/a/777204dbaf03dc45) – Casey
@Alex rvalues는 임시 변수, 함수 반환 값 및 lvalue의'std :: move (...) '결과에 해당합니다. 포인터가 괜찮을거야. – Casey