[QUESTION] MSVC: INTERNAL COMPILER ERROR in combiation with boost::container and boost::movelib::unique_ptr

Đang mở
#1,149 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

Xem xét các tệp SkinTimer.cpp và SkinTimerManager.cpp được đính kèm, tập trung vào CSkinTimerManager::TimerIsRunning và khai báo boost::container::map. Tái hiện lỗi MSVC C1001 với thiết lập Boost 1.57.0 đã được báo cáo, so sánh trường hợp boost::unordered_map và xác định liệu việc sử dụng nó có phù hợp hay cần hướng dẫn tương thích nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi! I hope you won't mid if I ask here but I am having some issues with old version of boost. More precisly it is 1.57.0. In short, I am developer of XBMC 4.0 which is backport of modern Kodi to Original Xbox from 2001 using official XDK which is C++98. Since C++98 is missing lot of modern C++11 features I found that boost has lot of them and I am using them as replacement for stuff like smart pointers, lambdas, container algorithms etc.

Problem which I am facing is related to unique_ptr. Kodi is using lot of std::unique_ptr which ofcourse is not available in C++98, so as replacement I am using boost::movelib::unique_ptr. It's working fine as long as it is not used in std containers like vector, set or map. Because there is no concept of move in C++98, having std::map<std::string, boost::movelib::unique_ptr> as return value of method will cause compiler error:

class 'boost::movelib::unique_ptr<T>' : no copy constructor available or copy constructor is declared 'explicit'

I have read somewhere that using vector, map or set from boost::container should fix that. But unfortunately for me, when I use boost::container::map<std::string, boost::movelib::unique_ptr> I get INTERNAL COMPILER ERROR:

Compiling...
SkinTimerManager.cpp
lib\boost\boost\intrusive\bstree_algorithms.hpp(620) : fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 2701) 
         Please choose the Technical Support command on the Visual C++ 
         Help menu, or open the Technical Support help file for more information

However, I've found out using boost::unordered_map won't crash compiler. So I am wondering why and can I use that instead of normal map?

Here is source code of files:
SkinTimer.cpp
SkinTimerManager.cpp

One of method which is failing is CSkinTimerManager::TimerIsRunning:

bool CSkinTimerManager::TimerIsRunning(const std::string& timer) const
{
  boost::container::map<std::string, boost::movelib::unique_ptr<CSkinTimer> >::const_iterator iter = m_timers.find(timer);
  if (iter != m_timers.end())
  {
    return iter->second->IsRunning(); <-- this line failes
  }
  CLog::Log(LOGERROR, "Couldn't find Skin Timer with name: {}", timer);
  return false;
}

And sorry again if this is not a place to ask for a help :)

Ngôn ngữ chính
HTML
Star
8.6k
Fork
2k
Merge trung bình
9 giờ 35 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của boostorg/boost

Tất cả issue của boostorg/boost

Issue tương tự

Thêm issue về Compilers

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.