<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Unconvertable type leads to invalid WebAssembly"
   href="https://bugs.llvm.org/show_bug.cgi?id=40412">40412</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unconvertable type leads to invalid WebAssembly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: WebAssembly
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dan433584@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On this C++ testcase:


class c;

template<class> class basic_streambuf {
  virtual c seekoff(unsigned);
};

basic_streambuf<char> x;


Clang produces LLVM IR for wasm32 containing this:

@_ZTV15basic_streambufIcE = linkonce_odr hidden unnamed_addr constant { [3 x
i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }*
@_ZTI15basic_streambufIcE to i8*), i8* bitcast (void ()*
@_ZN15basic_streambufIcE7seekoffEj to i8*)] }, comdat, align 4

declare void @_ZN15basic_streambufIcE7seekoffEj() unnamed_addr


seekoff's argument types don't match the types in the C++ source file, which
causes wasm-ld to ultimately complain about the signature mismatch.

This is a reduced form of code in libcxx which causes wasm-ld to complain when
linking C++ programs:

wasm-ld: warning: function signature mismatch:
_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7seekoffExNS_8ios_base7seekdirEj
<span class="quote">>>> defined as (i32, i32, i64, i32, i32) -> void in [...]/libc++.a(ios.cpp.obj)
>>> defined as () -> void in [...]/libc++.a(iostream.cpp.obj)</span ></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>