<div dir="ltr"><div style="font-size:12.8px">I am trying to enable Clang Modules using latest version of clang on a tiny example, but getting the following error: <br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">error: 'std::vector' has different definitions in different modules</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">1) Documentation from <a href="http://clang.llvm.org/docs/Modules.html#modularizing-a-platform" target="_blank">http://clang.llvm.org/doc<wbr>s/Modules.html#modularizing-a-<wbr>platform</a> says</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">>> <span style="color:rgb(51,51,51);font-family:"DejaVu Sans",Arial,Helvetica,sans-serif;font-size:14.4px;text-align:justify">To get any benefit out of modules, one needs to introduce module maps for software libraries starting at the bottom of the stack.</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Does it mean that modularization of system/std headers is **required** before going upper levels?<br></div><div style="font-size:12.8px">I am not using modulemaps on standard headers and would like to avoid that for now. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">2) When I try some older version of clang (say from April 2017) it doesn't show this error on the same input. Does it mean there was regression happened in between? Or the current behavior is actually expected?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Below comes more details and reproduction.<br></div><div style="font-size:12.8px">Full message:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">In file included from main.cpp:1:</div><div style="font-size:12.8px">In file included from /usr/lib/gcc/x86_64-redhat-lin<wbr>ux/4.8.5/../../../../include/<wbr>c++/4.8.5/vector:64:</div><div style="font-size:12.8px">/usr/lib/gcc/x86_64-redhat-lin<wbr>ux/4.8.5/../../../../include/<wbr>c++/4.8.5/bits/stl_vector.h:<wbr>210:11: error: 'std::vector' has different definitions in</div><div style="font-size:12.8px">      different modules; defined here</div><div style="font-size:12.8px">    class vector : protected _Vector_base<_Tp, _Alloc></div><div style="font-size:12.8px">          ^</div><div style="font-size:12.8px">/usr/lib/gcc/x86_64-redhat-lin<wbr>ux/4.8.5/../../../../include/<wbr>c++/4.8.5/bits/stl_vector.h:<wbr>210:11: note: definition in module 'experimental_Range_h' is here</div><div style="font-size:12.8px">    class vector : protected _Vector_base<_Tp, _Alloc></div><div style="font-size:12.8px">          ^</div><div style="font-size:12.8px">1 error generated.<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">The files I am using:</div><div style="font-size:12.8px">// -- main.cpp:</div><div style="font-size:12.8px">#include <vector></div><div style="font-size:12.8px">#include "Range.h"<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">int main () {<br></div><div style="font-size:12.8px">  return 0;</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br>// -- Range.h:<br></div><div style="font-size:12.8px">#pragma once</div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">#include <string></span><br></div><div style="font-size:12.8px">#include "Bits.h"</div><div style="font-size:12.8px">#include <vector></div><div style="font-size:12.8px"><br>// -- Bit.h:</div><div style="font-size:12.8px">#pragma once</div><div style="font-size:12.8px"><span style="font-size:12.8px">#include <iterator></span><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">// -- module.modulemap:</div><div style="font-size:12.8px">module experimental_Bits_h {</div><div style="font-size:12.8px">   header "Bits.h"</div><div style="font-size:12.8px">   export *</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">module experimental_Range_h {</div><div style="font-size:12.8px">   header "Range.h"</div><div style="font-size:12.8px">   export *</div><div style="font-size:12.8px">}</div><div style="font-size:12.8px"><br>Commandline: </div><div style="font-size:12.8px">$ clang++ --std=c++14 -I .  -fmodules -fcxx-modules -fmodules-cache-path=./modules<wbr>_out/_module_cache -c main.cpp -o main.o<br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">$ clang++ --version<br></div><div style="font-size:12.8px">clang version 5.0.0 (<a href="http://llvm.org/git/clang.git" target="_blank">http://llvm.org/git/clang.git</a><wbr> <wbr>742c4c842393005d91a6f805f665b0<wbr>77014d061a) (<a href="http://llvm.org/git/llvm.git" target="_blank">http://llvm.org/git/llvm.git</a> <wbr>a98fd55665d422389d69d94efe631f<wbr>ac93d11173)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">-- </div><div style="font-size:12.8px">Thanks,</div><div style="font-size:12.8px">Dmitry</div><div class="gmail-yj6qo gmail-ajU" style="margin:2px 0px 0px;font-size:12.8px"></div></div>