[LLVMbugs] [Bug 19668] New: GCC ABI incompatibility when passing object with trivial copy ctor, trivial dtor, and non-trivial move ctor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 6 18:11:22 PDT 2014


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

            Bug ID: 19668
           Summary: GCC ABI incompatibility when passing object with
                    trivial copy ctor, trivial dtor, and non-trivial move
                    ctor
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvmbugs at cs.uiuc.edu, richard-llvm at metafoo.co.uk
    Classification: Unclassified

Consider:
$ cat t.cpp 
#include <assert.h>
struct A {
  A() : x(42) {}
  A(A &&o) : x(o.x) {}
  // no dtor, no copy ctor
  int x;
};
void foo(A a);
#ifdef CONFIG_1
void foo(A a) {
  assert(a.x == 42);
}
#else
int main() {
  foo(A());
}
#endif

$ clang++ -c -DCONFIG_1 -std=c++0x t.cpp -o t1.o && g++ -c -std=c++0x t.cpp -o
t2.o && g++ t1.o t2.o -o t && ./t
t: t.cpp:11: void foo(A): Assertion `a.x == 42' failed.
Aborted (core dumped)

This looks like it's been present since Clang added support for C++11.  I doubt
anyone ever hits it because if you have a non-trivial move ctor, you probably
have a dtor.

-- 
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/20140507/404519b4/attachment.html>


More information about the llvm-bugs mailing list