Код: Выделить всё
module;
#include
#include
export module foo;
export namespace bar {
using std::regex;
using std::smatch;
using std::regex_search;
using std::string;
}
Код: Выделить всё
import foo;
int main() {
bar::regex regex;
bar::smatch match;
bar::string s;
bar::regex_search(s, match, regex);
}
Код: Выделить всё
cmake_minimum_required(VERSION 4.0.0)
set(CMAKE_CXX_STANDARD 23)
project(cpptest)
add_library(module STATIC)
target_sources(module PUBLIC FILE_SET CXX_MODULES FILES module.cppm)
add_executable(cpptest main.cpp)
target_link_libraries(cpptest module)
Код: Выделить всё
cmake -B build -G Ninja
cmake --build ./build/
Код: Выделить всё
/usr/local/gcc-15.1/include/c++/15/bits/regex.tcc:56:16: error: ‘std::__cxx11::basic_regex::_AutomatonPtr std::__cxx11::basic_regex::_M_automaton’ is private within this context
56 | if (__re._M_automaton == nullptr)
| ~~~~~^~~~~~~~~~~~
/usr/local/gcc-15.1/include/c++/15/bits/regex.h:848:25: note: declared private here
848 | _AutomatonPtr _M_automaton;
Есть ли быстрое решение этой проблемы? Знает ли GCC об этой проблеме?
Подробнее здесь: https://stackoverflow.com/questions/797 ... rom-module
Мобильная версия