https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121963
--- Comment #11 from Nathaniel Shead <nshead at gcc dot gnu.org> --- (In reply to Jussi Pakkanen from comment #10) > > At least for this, it might also be good to have an option to include the > > language dialect flags in the default gcm.cache path to prevent these kinds > > of clashes. > > Also it would be nice to know if linking multiple different versions of the > std module into a single target is IFNDR or if there is magic happening > behind the scenes guaranteeing that the mixing will work. > > If it is the former, then mixing different language versions within a single > target is not supported when using modules, even though it is supported when > doing things "the old fashioned way". The standard doesn't really talk about this, as mixing language modes is outside of the standard's purview. My current view for GCC is that importing different module CMIs for different language modes of a given interface is OK iff mixing those equivalent declarations across different TUs built with those different flags in a non-modules world would have been OK. And of course the built object file for a module interface file should be linked to only once. (The std module's object file should be basically empty on most configurations so you're unlikely to run into real issues if you don't follow this rule, but it can be important for other modules.)
