[LLVMbugs] [Bug 18435] New: [-cxx-abi microsoft] constructor called the wrong number of times

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 9 20:09:23 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18435

            Bug ID: 18435
           Summary: [-cxx-abi microsoft] constructor called the wrong
                    number of times
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:
extern "C" int printf(const char *fmt, ...);
struct ClassName0 {
  ClassName0() { printf("ctor called\n"); }
};
struct ClassName1 : virtual ClassName0 {};
struct ClassName2 : ClassName1, ClassName0 {};
template <typename Class>
static void init_mem() {
  Class x;
}
int main() {
  init_mem<ClassName1>();
  init_mem<ClassName2>();
}

compile with:
clang++ -x c++ different.cpp -target i386-pc-win32 -Xclang -cxx-abi -Xclang
microsoft -fms-compatibility -fno-rtti -fms-extensions -c -o different.obj

link with:
link -nologo different.obj 'c:/Program Files/Microsoft Visual Studio
9.0/VC/lib/msvcrt.lib'

output is:
ctor called
ctor called

MSVC's is:
ctor called
ctor called
ctor called

-- 
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/20140110/42c0a1bb/attachment.html>


More information about the llvm-bugs mailing list