I'm having a C1001 issue (internal compiler error) when a class is declared and not when it is commented. Compiling the following code with
cl /std:c++latest /O2 /Oi /fp:fast /Gy /GL /Gw /EHsc /MD /nologo /openmp:experimental /analyze /c -I"C:\Program Files (x86)\Windows Kits10円\Include10円.0.26100.0\ucrt" -I"C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include" "C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\modules\std.ixx"
cl /std:c++latest /O2 /Oi /fp:fast /Gy /GL /Gw /EHsc /MD /nologo /openmp:experimental /analyze /c /Wall /WX /wd4514 /wd4619 /wd4242 /wd4820 /wd5031 /wd4625 /wd4365 /wd4668 /wd5026 /wd4626 /wd5027 -I"C:\Program Files\boost\boost_1_82_0" -I"C:\Program Files (x86)\Windows Kits10円\Include10円.0.26100.0\shared" -I"C:\Program Files (x86)\Windows Kits10円\Include10円.0.26100.0\ucrt" -I"C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include" def.ixx
cl /std:c++latest /O2 /Oi /fp:fast /Gy /GL /Gw /EHsc /MD /nologo /openmp:experimental /analyze /c /Wall /WX -I"C:\Program Files\MATLAB\R2025a\extern\include" -I"C:\Program Files (x86)\Windows Kits10円\Include10円.0.26100.0\ucrt" -I"C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include" utils.ixx
// def.ixx
module;
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
export module def;
import std;
export namespace def
{
using dictionary = std::unordered_map<std::string, std::variant<double, std::string, bool, std::vector<double>, int, std::size_t>>;
using results = std::unordered_map<std::string, std::vector<double>>;
class Cache
{
public:
std::unordered_map<std::string, results> data;
private:
friend class boost::serialization::access;
template <class Archive>
auto serialize(Archive &ar, const unsigned int version) -> void
{
ar & data;
}
};
}
// utils.ixx
module;
#include <mex.h>
export module utils;
import std;
import def;
export namespace utils
{
inline auto dictionaryToUnorderedMap(const mxArray *dict) -> def::dictionary
{
def::dictionary res;
// code removed
return res;
}
}
leads to
utils.ixx(13): fatal error C1001: Internal compiler error.
(compiler file 'msc1.cpp', line 1589)
To work around this problem, try simplifying or changing the program near the locations listed above.
If possible please provide a repro here: https://developercommunity.visualstudio.com
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
utils.ixx(13): note: the template instantiation context (the oldest one first) is
utils.ixx(12): note: see reference to class template instantiation 'std::unordered_map<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>,std::hash<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::equal_to<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::allocator<std::pair<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>>>>' being compiled
C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(61): note: see reference to class template instantiation 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>' being compiled
with
[
_Kty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
_Ty=std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>,
_Hasher=std::hash<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,
_Keyeq=std::equal_to<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,
_Alloc=std::allocator<std::pair<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>>>
]
C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\xhash(330): note: see reference to class template instantiation 'std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>' being compiled
with
[
_Kty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
_Ty=std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>,
_Hasher=std::hash<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,
_Keyeq=std::equal_to<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,
_Alloc=std::allocator<std::pair<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::variant<double,std::basic_string<char,std::char_traits<char>,std::allocator<char>>,bool,std::vector<double,std::allocator<double>>,int,size_t>>>
]
C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(29): note: see reference to class template instantiation 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>' being compiled
with
[
_Kty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
_Hasher=std::hash<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,
_Keyeq=std::equal_to<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>
]
INTERNAL COMPILER ERROR in 'C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\bin\Hostx64\x64\cl.exe'
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
However, if one comments out the Cache class it compiles fine.
1 Answer 1
I encountered a similar issue. The compiler error occurs when instantiate the unordered_map.
My build log is:
[build] FAILED: [code=3221225477] epix_engine/core/CMakeFiles/test_core_module_test.dir/tests/module/test.cpp.obj
[build] C:\PROGRA~1\MICROS~42022円\COMMUN~1\VC\Tools\MSVC1444円~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DEPIX_USE_VOLK -DSPDLOG_COMPILED_LIB -DSPDLOG_USE_STD_FORMAT -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\include -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\thread-pool\include -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\spdlog\include -external:IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\googletest\googletest\include -external:IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++latest -MDd -Zi /bigobj /showIncludes @epix_engine\core\CMakeFiles\test_core_module_test.dir\tests\module\test.cpp.obj.modmap /Foepix_engine\core\CMakeFiles\test_core_module_test.dir\tests\module\test.cpp.obj /Fdepix_engine\core\CMakeFiles\test_core_module_test.dir\ /FS -c E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\tests\module\test.cpp
[build] E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\tests\module\test.cpp(8): fatal error C1001: Internal compiler error.
[build] (compiler file 'msc1.cpp', line 1589)
[build] To work around this problem, try simplifying or changing the program near the locations listed above.
[build] If possible please provide a repro here: https://developercommunity.visualstudio.com
[build] Please choose the Technical Support command on the Visual C++
[build] Help menu, or open the Technical Support help file for more information
[build] E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\tests\module\test.cpp(8): note: the template instantiation context (the oldest one first) is
[build] E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\src\modules\app.cppm(470): note: see reference to class template instantiation 'std::unordered_map<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>,std::hash<core::AppLabel>,std::equal_to<core::AppLabel>,std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>' being compiled
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(61): note: see reference to class template instantiation 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>' being compiled
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>,
[build] _Alloc=std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\xhash(330): note: see reference to class template instantiation 'std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>' being compiled
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>,
[build] _Alloc=std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(29): note: see reference to class template instantiation 'std::_Uhash_compare<_Kty,_Hasher,_Keyeq>' being compiled
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>
[build] ]
[build] INTERNAL COMPILER ERROR in 'C:\PROGRA~1\MICROS~42022円\COMMUN~1\VC\Tools\MSVC1444円~1.352\bin\Hostx64\x64\cl.exe'
[build] Please choose the Technical Support command on the Visual C++
[build] Help menu, or open the Technical Support help file for more information
Then I tried to explicitly instantiate the unordered_map that used in the struct at the same module, no internal error anymore but a new error:
[build] FAILED: [code=2] epix_engine/core/CMakeFiles/epix_core.dir/src/modules/app.cppm.obj epix_engine/core/CMakeFiles/epix_core.dir/epix.core-app.ifc
[build] C:\PROGRA~1\MICROS~42022円\COMMUN~1\VC\Tools\MSVC1444円~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DEPIX_ENABLE_TEST -DEPIX_USE_VOLK -DSPDLOG_COMPILED_LIB -DSPDLOG_USE_STD_FORMAT -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\include -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\thread-pool\include -IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\spdlog\include -external:IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\googletest\googletest\include -external:IE:\Programming\Projects\C++\cmake\pixel_engine.cmake\libs\googletest\googletest -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++latest -MDd -Zi /bigobj /showIncludes @epix_engine\core\CMakeFiles\epix_core.dir\src\modules\app.cppm.obj.modmap /Foepix_engine\core\CMakeFiles\epix_core.dir\src\modules\app.cppm.obj /Fdepix_engine\core\CMakeFiles\epix_core.dir\epix_core.pdb /FS -c E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\src\modules\app.cppm
[build] app.cppm
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): error C2679: binary '=': no operator found which takes a right-hand operand of type 'const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>' (or there is no acceptable conversion)
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(333): note: could be 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(volatile const std::pair<_Kty,_Ty> &)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(volatile const std::pair<_Kty,_Ty> &)': cannot convert argument 2 from 'const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>' to 'volatile const std::pair<_Kty,_Ty> &'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(412): note: or 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>,0>(std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>> &&) noexcept(<expr>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>,0>(std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>> &&) noexcept(<expr>)': cannot convert argument 2 from 'const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>' to 'std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>> &&'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: Conversion loses qualifiers
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(363): note: or 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =<std::pair<_Kty,_Ty>,0>(_Myself &&) noexcept(<expr>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Myself=std::pair<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =<std::pair<_Kty,_Ty>,0>(_Myself &&) noexcept(<expr>)': cannot convert argument 2 from 'const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>' to '_Myself &&'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Myself=std::pair<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>
[build] ]
[build] and
[build] [
[build] _Myself=std::pair<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: Reason: cannot convert from 'const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>' to '_Myself'
[build] with
[build] [
[build] _Myself=std::pair<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(446): note: or 'const std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Other &&) noexcept(<expr>) const'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(444): note: 'get': no matching overloaded function found
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(206): note: could be 'const _Ty &&std::get(const std::array<_Ty,_Size> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(203): note: or '_Ty &&std::get(std::array<_Ty,_Size> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(200): note: or 'const _Ty &std::get(const std::array<_Ty,_Size> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(197): note: or '_Ty &std::get(std::array<_Ty,_Size> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(194): note: or 'const tuple_element<_Index,std::tuple<_Types...>>::type &&std::get(const std::tuple<_Types...> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(191): note: or 'tuple_element<_Index,std::tuple<_Types...>>::type &&std::get(std::tuple<_Types...> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(188): note: or 'const tuple_element<_Index,std::tuple<_Types...>>::type &std::get(const std::tuple<_Types...> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(185): note: or 'tuple_element<_Index,std::tuple<_Types...>>::type &std::get(std::tuple<_Types...> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(434): note: or 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Other &&) noexcept(<expr>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(432): note: 'get': no matching overloaded function found
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(206): note: could be 'const _Ty &&std::get(const std::array<_Ty,_Size> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(203): note: or '_Ty &&std::get(std::array<_Ty,_Size> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(200): note: or 'const _Ty &std::get(const std::array<_Ty,_Size> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(197): note: or '_Ty &std::get(std::array<_Ty,_Size> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(194): note: or 'const tuple_element<_Index,std::tuple<_Types...>>::type &&std::get(const std::tuple<_Types...> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(191): note: or 'tuple_element<_Index,std::tuple<_Types...>>::type &&std::get(std::tuple<_Types...> &&) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(188): note: or 'const tuple_element<_Index,std::tuple<_Types...>>::type &std::get(const std::tuple<_Types...> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(185): note: or 'tuple_element<_Index,std::tuple<_Types...>>::type &std::get(std::tuple<_Types...> &) noexcept'
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(423): note: or 'const std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(std::pair<_Other1,_Other2> &&) noexcept(<expr>) const'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(422): note: the constraint was not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(399): note: or 'const std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(const std::pair<_Other1,_Other2> &) noexcept(<expr>) const'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(398): note: the constraint was not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(387): note: or 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(const std::pair<_Other1,_Other2> &) noexcept(<expr>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(const std::pair<_Other1,_Other2> &) noexcept(<expr>)': could not deduce template argument for '__formal'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(384): note: 'std::enable_if_t<false,int>' : Failed to specialize alias template
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(374): note: or 'const std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Identity<_Myself&&>::type) noexcept(<expr>) const'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(372): note: the constraint was not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(350): note: or 'const std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Identity<const _Myself&>::type) noexcept(<expr>) const'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the associated constraints are not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(348): note: the constraint was not satisfied
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(339): note: or 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Identity<const _Myself&>::type) noexcept(<expr>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: 'std::pair<_Kty,_Ty> &std::pair<_Kty,_Ty>::operator =(_Identity<const _Myself&>::type) noexcept(<expr>)': could not deduce template argument for '__formal'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\utility(336): note: 'std::enable_if_t<false,int>' : Failed to specialize alias template
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: while trying to match the argument list '(std::pair<_Kty,_Ty>, const std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\list(1315): note: the template instantiation context (the oldest one first) is
[build] E:\Programming\Projects\C++\cmake\pixel_engine.cmake\epix_engine\core\src\modules\app.cppm(470): note: see reference to class template instantiation 'std::unordered_map<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>,std::hash<core::AppLabel>,std::equal_to<core::AppLabel>,std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>' being compiled
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(61): note: see reference to class template instantiation 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>' being compiled
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>,
[build] _Alloc=std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\xhash(747): note: while compiling class template member function 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>> &std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>::operator =(const std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>> &)'
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>,
[build] _Alloc=std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\unordered_map(244): note: see the first reference to 'std::_Hash<std::_Umap_traits<_Kty,_Ty,std::_Uhash_compare<_Kty,_Hasher,_Keyeq>,_Alloc,false>>::operator =' in 'std::unordered_map<core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>,std::hash<core::AppLabel>,std::equal_to<core::AppLabel>,std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>::operator ='
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _Hasher=std::hash<core::AppLabel>,
[build] _Keyeq=std::equal_to<core::AppLabel>,
[build] _Alloc=std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>
[build] ]
[build] C:\Program Files\Microsoft Visual Studio2022円\Community\VC\Tools\MSVC14円.44.35207\include\xhash(783): note: see reference to function template instantiation 'void std::list<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>,std::allocator<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>::_Assign_cast<std::pair<_Kty,_Ty>&,std::_List_unchecked_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>,std::_Iterator_base0>>(_UIter,const _UIter)' being compiled
[build] with
[build] [
[build] _Kty=core::AppLabel,
[build] _Ty=std::unique_ptr<core::App,std::default_delete<core::App>>,
[build] _UIter=std::_List_unchecked_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const core::AppLabel,std::unique_ptr<core::App,std::default_delete<core::App>>>>>,std::_Iterator_base0>
[build] ]
This time no internal compiler error, but a new error occured in std::list which is instantiated when instantiating std::unordered_map.
The version of msvc is 19.44.35222. The newest version of msvc, and the problem still exists.
And I tried to explicitly instantiate the unordered_map at the place where the struct is used before the first use of the struct, the errors completely gone and compiles successfully.
Overall, the code is valid and should compile fine, its a compiler issue. But until it is fixed, explicitly instantiate the unordered_map can be a temporary workaround.
Also part of the code:
// module.ixx
export module app;
import std;
// import :others;
struct App {
std::unordered_map<AppLabel, std::unique_ptr<App>> _sub_apps;
};
template class std::unordered_map<AppLabel, std::unique_ptr<App>>;
// The above line removes internal compiler error, and result in new error.
// main.cpp
import std;
import app;
int main() {
std::unordered_map<AppLabel, std::unique_ptr<App>> map;
// above line makes the project compile successfully
App app{};
}
friend class boost::serialization::access;and the two Boost headers?) The simpler your example, the better, both for this question and for your report to Microsoft.