<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi, modules folks and cfe-dev. I <i class="">think</i><span style="font-style: normal;" class=""> I've discovered a bug in how module loading handles redeclaration merging, but it might also be by design. (And honestly "by design" would be nice in my particular use case.) Here it is:</span><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><span style="font-style: normal;" class="">// ModuleA.h</span></div><div class=""><span style="font-style: normal;" class="">void test() {</span></div><div class=""><span style="font-style: normal;" class="">  extern void sharedFunc(void);</span></div><div class=""><span style="font-style: normal;" class="">}</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><span style="font-style: normal;" class="">// ModuleB.h</span></div><div class="">void sharedFunc(int);</div><div class=""><br class=""></div><div class="">// client.c</div><div class="">#import <ModuleA.h></div><div class="">#import <ModuleB.h></div><div class="">// or the other order, for a slightly different experiment</div></blockquote><br class=""><div class="">In this situation, the locally-scoped declaration of 'sharedFunc' in ModuleA isn't resolved with the declaration in ModuleB. There's even a conflict in their types! Is this by design, or an oversight, or what?</div><div class=""><br class=""></div><div class="">One of the consequences of this is that in client.c's context, asking for the canonical decl for 'sharedFunc' gives me the declaration in ModuleB. From client.c's perspective, that's <i class="">more</i><span style="font-style: normal;" class=""> useful than giving me the one in ModuleA, but it's not consistent with the behavior with modules turned off.</span></div><div class=""><span style="font-style: normal;" class=""><br class=""></span></div><div class=""><span style="font-style: normal;" class="">Any insights to offer? Should I file this at <a href="http://bugs.llvm.org" class="">bugs.llvm.org</a>?</span></div><div class=""><span style="font-style: normal;" class="">Thanks,</span></div><div class="">Jordan</div></body></html>