[llvm-bugs] [Bug 33950] New: Bogus warning with -Wweak-vtables when class declared inside .cpp file

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 26 09:23:35 PDT 2017


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

            Bug ID: 33950
           Summary: Bogus warning with -Wweak-vtables when class declared
                    inside .cpp file
           Product: new-bugs
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: amomum at yandex.ru
                CC: llvm-bugs at lists.llvm.org

clang -v
Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: i386-pc-linux-gnu


This code:

class B
{};

class A : B
{
        virtual void do_smthn()
        {}
};

int main(void)
{
        A a;

        return 0;       
}

compiled with:

"clang++ -Wweak-vtables"

produces bogus warning:

"'A' has no out-of-line virtual method definitions; its vtable will be emitted
in every translation unit [-Wweak-vtables]"

This should not happen since whole class definition is inside one translation
unit.

This warning dissapears if I surround class definition in anonymous namespace.

-- 
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/20170726/146096db/attachment.html>


More information about the llvm-bugs mailing list