This fixes issue51873. The issue reports that we couldn't run hello world example in C++20 module. Then I found that the reason is that libstdc++ uses static variable to initialize resources for streams like std::cout. And it would be good if we use libc++.
So the key point here is that wether or not the definition of static variables should be remained in module interface. First I thought the reduction makes sense. Since static variable shouldn't be able to be referred outside the module. Then @rsmith pointed out that this one should be a bug.
The patch tries to remain the definition for dynamic initializing internal-linkage variable.
rather than generate a foo.h file, why not (ab)use the preprocessor with internal line directives?
module; # 3 __FILE__ 1 // use the next physical line number here (and below) struct S { S(); }; static S s = S(); # 6 "" 2 export module m; ...