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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to