<div dir="ltr"><div>Thanks for looking! </div><div>Submitted into bugzilla as: <a href="https://bugs.llvm.org/show_bug.cgi?id=33924">https://bugs.llvm.org/show_bug.cgi?id=33924</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 24, 2017 at 7:52 PM, Bruno Cardoso Lopes <span dir="ltr"><<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Dmitry,<br>
<span class="gmail-"><br>
On Sat, Jul 22, 2017 at 12:31 PM, Dmitry Panin via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> I am trying to use Clang Modules, but getting the following error:<br>
><br>
> error: definition with same mangled name as another definition<br>
><br>
> Full message:<br>
><br>
> In module 'foo1' imported from main.cpp:1:<br>
> In module 'format' imported from ./foo1.h:3:<br>
> ./format.h:6:8: error: definition with same mangled name as another<br>
> definition<br>
> void doFormat(T& out) {}<br>
> ^<br>
> ./format.h:6:8: note: previous definition is here<br>
><br>
> It seems like the error is happening when we pass lambda as templated<br>
> argument (see below for minimized example).<br>
><br>
> Is this error expected? I am not sure how should I fix that as clang points<br>
> to exactly the same place for previous definition.<br>
<br>
</span>Looks like it should work, can you file a bug?<br>
<div><div class="gmail-h5"><br>
><br>
> Using clang built from latest trunk shows the same error, but also the<br>
> following failed assertion:<br>
><br>
> llvm/lib/IR/Value.cpp:402: void llvm::Value::doRAUW(llvm::<wbr>Value*, bool):<br>
> Assertion `New->getType() == getType(<br>
> ) && "replaceAllUses of value with new value of different type!"' failed.<br>
><br>
><br>
> Here is the following self-contained example:<br>
> Commandline:<br>
> clang++ --std=c++14 -I . -fmodules -fcxx-modules<br>
> -fmodules-cache-path=./<wbr>modules_out/_module_cache -c main.cpp -o main.o<br>
><br>
> Files:<br>
> // --- main.cpp<br>
> #include "foo1.h"<br>
> #include "foo2.h"<br>
><br>
> int main () {<br>
> return 0;<br>
> }<br>
><br>
> // -- foo1.h<br>
> #pragma once<br>
><br>
> #include "format.h"<br>
><br>
> void foo1() {<br>
> format(0);<br>
> }<br>
><br>
> // -- foo2.h<br>
> #pragma once<br>
><br>
> #include "format.h"<br>
><br>
> void foo2() {<br>
> format(0);<br>
> }<br>
><br>
> // -- format.h<br>
> #pragma once<br>
><br>
> class Formatter {<br>
> public:<br>
> template <class T><br>
> void doFormat(T& out) {}<br>
> };<br>
><br>
><br>
> template <class T><br>
> void format(T t) {<br>
> Formatter f;<br>
> auto lambda = [] {};<br>
> f.doFormat(lambda);<br>
> }<br>
><br>
><br>
> // -- module.modulemap<br>
> module foo1 {<br>
> header "foo1.h"<br>
> export *<br>
> }<br>
><br>
> module foo2 {<br>
> header "foo2.h"<br>
> export *<br>
> }<br>
><br>
> module format {<br>
> header "format.h"<br>
> export *<br>
> }<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
><br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Bruno Cardoso Lopes<br>
<a href="http://www.brunocardoso.cc" rel="noreferrer" target="_blank">http://www.brunocardoso.cc</a><br>
</font></span></blockquote></div><br></div></div>