tonykuttai wrote: > > @tonykuttai, I think the treatment of C++20 modules requires > > documentation/testing. > > For example, the option applies to a variable defined in a module unit at > > the time the module unit is compiled to object code. What happens to > > specializations of static data members instantiated from imported template > > definitions? Did we really need to allow static data members? > > Support is now limited to file and namespace-scope variables. All > name-matched static data members, variable template specializations (explicit > ones included), and function-local statics now get the not-preserved > diagnostic. Implicit instantiations are diagnosed via the > template-instantiation path, once per instantiating TU.
On testing we found that an unreferenced internal-linkage named variable (the `static char sccsid[]` idiom itself) was silently dropped whenever its definition crossed a serialization boundary. External and module-linkage variables were unaffected. Two causes: `ASTContext::DeclMustBeEmitted` did not know the implicit attribute, and for named modules only non-discardable variables are recorded in the module-initializer lists CodeGen walks when compiling a module unit from its BMI. This is now fixed. One deliberate behavior change: since DeclMustBeEmitted now sees the attribute, -Wunused-const-variable no longer fires for a preserved variable. https://github.com/llvm/llvm-project/pull/187986 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
