r/cpp • u/Expert_Sheepherder24 • 18h ago
MSVC automatic import std::vector bug
https://developercommunity.visualstudio.com/t/MSVC-C20-modules-expose-std::vector-on/11135469?sort=newest&scope=follow//math.ixx
module;
#include <vector>
export module math;
//nothing is exported
//main.cpp Vs2026 18.9.2
import math;
int main()
{
std::vector<char> value = { 'a', 'b', 'c'}; // OK, but why?
return 0;
}
1
Upvotes
View all comments
5
u/kamrann_ 10h ago
MSVC's modules implementation is broken on the "too permissive" side of things in numerous ways that probably tend to go unnoticed if it's your only compiler. Really fundamental stuff. It incorrectly allows use of names that are imported transitively without an intermediate "export import". It allows declarations from one module to be defined in an another. Every time I take code that I've been developing for a while on Windows and try to compile on Linux with clang, it invariably shows the code to have been totally broken.