<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - clang-cl: vtordisp thunks not emitted for functions with class template specializations in their signatures"
   href="https://llvm.org/bugs/show_bug.cgi?id=25641">25641</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl: vtordisp thunks not emitted for functions with class template specializations in their signatures
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>stephan.bergmann.secondary@googlemail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On recent trunk:

<span class="quote">> $ cat test.cc
> struct Color {};
> template<typename> struct SharedPtr {};
> struct Canvas {
>     virtual ~Canvas() {}
>     virtual void getClip() = 0;
>     virtual SharedPtr<Color> createColor() = 0;
> };
> struct BitmapCanvas: virtual Canvas {};
> struct ImplCanvas: virtual Canvas {
>     virtual ~ImplCanvas();
>     void getClip() override;
>     SharedPtr<Color> createColor() override;
> };
> struct ImplBitmapCanvas: virtual BitmapCanvas, virtual ImplCanvas {
>     virtual ~ImplBitmapCanvas();
> };
> ImplBitmapCanvas::~ImplBitmapCanvas() {}
> ImplBitmapCanvas c;</span >

<span class="quote">> $ clang-cl -c test.cc</span >

<span class="quote">> $ llvm-nm test.obj | grep -F '?getClip@ImplCanvas@@$'
> 00000000 T ?getClip@ImplCanvas@@$4PPPPPPPM@A@EAAXXZ
> 00000000 T ?getClip@ImplCanvas@@$R4BA@M@PPPPPPPM@BA@EAAXXZ</span >

<span class="quote">> $ llvm-nm test.obj | grep -F '?createColor@ImplCanvas@@$'
>          U ?createColor@ImplCanvas@@$4PPPPPPPM@A@EAA?AU?$SharedPtr@UColor@@@@XZ
>          U ?createColor@ImplCanvas@@$R4BA@M@PPPPPPPM@BA@EAA?AU?$SharedPtr@UColor@@@@XZ</span >

The vtordisp thunks for getClip are emitted, while those for createColor are
erroneously missing.

The reason is that CodeGenVTabels::maybeEmitThunkForVtable
(lib/CodeGen/CGVtables.cpp) returns early if !isFuncTypeConvertible, which hits
here as the ClassTemplateSpecializationDecl for SharedPtr<Color> is
!isCompleteDefinition, as there's no code in Sema that happens to call
Sema::RequireCompleteType -> Sema::InstantiateClassTemplateSpecialization on
it.</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>