module complie error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-11 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
//num.ixx
module; //global module
//#incldue <> //lib not modularized
#include <bits/stdc++.h>
export module random:num;
//import //module
// //non-export declaration
export
{
inline int random_
inline int random_
}
inline int random_
{
std:
std::mt19937 gen(rd()); // 使用Mersenne Twister引擎
std:
return dist(gen);
}
inline int random_
{
std::mt19937 gen(seed); // 随机数引擎
std:
return dist(gen);
}
//random.ixx
module; //global module
//#incldue <> //lib not modularized
export module random;
//import //module
export import :num;
// //non-export declaration
export
{
void f()
{}
}
//complie way
MODULE_FLAGS=-g -std=c++20 -fmodules-ts -x c++ -c
g++ ${MODULE_FLAGS} num.ixx
g++ ${MODULE_FLAGS} random.ixx
//issue
1 . i dont know what happened since i add flag:-g
2 . before that , there still have issue :
when i import random to use the function random_num(range) , when i step : std::random_device rd;
a error occasion from bit/string.h? but i cant formally use random_device in header system project?
++ -g -std=c++20 -fmodules-ts -x c++ -c num.ixx start_call_ main
../sysdeps/ nptl/libc_ start_call_ main.h: 58 start_main_ impl
../csu/ libc-start. c:392
g++ -g -std=c++20 -fmodules-ts -x c++ -c random.ixx
random.ixx:5:8: internal compiler error: in tree_node, at cp/module.cc:9061
5 | export module random;
| ^~~~~~
0x7ff64f229d8f __libc_
0x7ff64f229e3f __libc_
Please submit a full bug report,
with preprocessed source if appropriate.