[llvm-bugs] [Bug 25641] New: clang-cl: vtordisp thunks not emitted for functions with class template specializations in their signatures

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 25 13:02:41 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25641

            Bug ID: 25641
           Summary: clang-cl: vtordisp thunks not emitted for functions
                    with class template specializations in their
                    signatures
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stephan.bergmann.secondary at googlemail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

On recent trunk:

> $ 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;

> $ clang-cl -c test.cc

> $ llvm-nm test.obj | grep -F '?getClip at ImplCanvas@@$'
> 00000000 T ?getClip at ImplCanvas@@$4PPPPPPPM at A@EAAXXZ
> 00000000 T ?getClip at ImplCanvas@@$R4BA at M@PPPPPPPM at BA@EAAXXZ

> $ llvm-nm test.obj | grep -F '?createColor at ImplCanvas@@$'
>          U ?createColor at ImplCanvas@@$4PPPPPPPM at A@EAA?AU?$SharedPtr at UColor@@@@XZ
>          U ?createColor at ImplCanvas@@$R4BA at M@PPPPPPPM at BA@EAA?AU?$SharedPtr at UColor@@@@XZ

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151125/f07e26a3/attachment.html>


More information about the llvm-bugs mailing list