<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 - Mangling of substitutions for nested depending types differs from GCC and llvm-cxxfilt"
   href="https://bugs.llvm.org/show_bug.cgi?id=50430">50430</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mangling of substitutions for nested depending types differs from GCC and llvm-cxxfilt
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>joachim@joameyer.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When trying to use GCC as host compiler for SYCL-BLAS and Clang as device /
library compiler, I could not link successfully, as there was a mangling
discrepancy.

I tried to reduce the example and ended up with:
<a href="https://godbolt.org/z/967PWWdv8">https://godbolt.org/z/967PWWdv8</a>
The difference is in the sequence id of the 3rd parameter, which should reuse
the 2nd parameter's template type.

When demangling using llvm-cxxfilt, Clang's mangling results in the 3rd
parameter's type to match the 1st parameter type's type instead of the second:

$ llvm-cxxfilt _Z1fI12TemplateTypeI8UsedTypeEiENT_6InnerT7NestedTERS3_T0_S6_
TemplateType<UsedType>::InnerT::NestedT f<TemplateType<UsedType>,
int>(TemplateType<UsedType>&, int, TemplateType<UsedType>&)

GCC references the correct one, as of llvm-cxxfilt:
$ llvm-cxxfilt _Z1fI12TemplateTypeI8UsedTypeEiENT_6InnerT7NestedTERS3_T0_S7_
TemplateType<UsedType>::InnerT::NestedT f<TemplateType<UsedType>,
int>(TemplateType<UsedType>&, int, int)

The offending type that is counted differently, is the nested depending types
-> it works if the return type would be `TemplateType<UsedType>::InnerT`
instead of `TemplateType<UsedType>::InnerT::NestedT` (see f2 in godbolt
example).</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>