Importing filesystem has caused issues with my project as it seems to be clashing with memory.
g++ -std=c++23 -fmodules-ts -xc++-system-header memory
g++ -std=c++23 -fmodules-ts -xc++-system-header filesystem
g++ -std=c++23 -fmodules-ts -xc++-system-header iostream
import <memory>;
import <filesystem>;
import <iostream>;
int main()
{
std::cout << "winner" << std::endl;
return 0;
}
This gives the following error
➜ g++ -std=c++23 -fmodules-ts -o main main.cpp
main.cpp: In destructor ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_construct(_InIterator, _InIterator, std::forward_iterator_tag)::_Guard::~_Guard() [with _InIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::char_traits<wchar_t>; _Alloc = std::allocator<wchar_t>]’:
main.cpp:10:14: warning: ignoring attributes applied to ‘std::auto_ptr< <template-parameter-1-1> >’ after definition [-Wattributes]
10 | std::cout << "winner" << std::endl;
| ^~~~
main.cpp:10:14: note: during load of pendings for ‘std::__cxx11::basic_string’
main.cpp: In function ‘int main()’:
main.cpp:10:14: note: during load of binding ‘std::cout’
Moving filesystem forward solves the error
import <filesystem>;
import <memory>;
import <iostream>;
int main()
{
std::cout << "winner" << std::endl;
return 0;
}
But trying to use it does the same thing
import <filesystem>;
import <memory>;
import <iostream>;
std::filesystem::path global;
int main()
{
std::cout << "winner" << std::endl;
return 0;
}
➜ g++ -std=c++23 -fmodules-ts -o main main.cpp
main.cpp: In destructor ‘constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_construct(_InIterator, _InIterator, std::forward_iterator_tag)::_Guard::~_Guard() [with _InIterator = const char*; _CharT = char8_t; _Traits = std::char_traits<char8_t>; _Alloc = std::allocator<char8_t>]’:
main.cpp:6:18: warning: ignoring attributes applied to ‘std::auto_ptr< <template-parameter-1-1> >’ after definition [-Wattributes]
6 | std::filesystem::path global;
| ^~~~
main.cpp:6:18: note: during load of pendings for ‘std::__cxx11::basic_string’
main.cpp: At global scope:
main.cpp:6:18: note: during load of binding ‘std::filesystem::__cxx11::path’
Will I just have to wait for P2465R3?