<div dir="ltr">This is relevant to <a href="https://bugs.llvm.org//show_bug.cgi?id=28593">https://bugs.llvm.org//show_bug.cgi?id=28593</a>.<div><br></div><div>See <a href="https://github.com/itanium-cxx-abi/cxx-abi/commit/eacbae1ebd0da58b25ddb57f5abf43efe6ab7cad">https://github.com/itanium-cxx-abi/cxx-abi/commit/eacbae1ebd0da58b25ddb57f5abf43efe6ab7cad</a>.</div><div><br></div><div>This means that clang does the wrong thing according to the ABI as well as the C++ standard for this program:</div><div><br></div><div><div>#include <stdio.h></div><div><br></div><div>struct S {</div><div>    int i;</div><div>    S(S*& p) { printf("S(): %p\n", this); p = this; }</div><div>    S(S const&) = delete;</div><div>};</div><div><br></div><div>S get_s(S*& p) { return S(p); }</div><div><br></div><div>int main() {</div><div>    S* p;</div><div>    S s = get_s(p);</div><div>    printf(" &s: %p\n", &s);</div><div>    printf("  p: %p\n", p);</div><div>    printf("%s\n", &s == p ? "same" : "different");</div><div>}</div></div><div><br></div><div>GCC prints "same". Clang prints "different". I'm actually not sure if that pointer comparison is defined behaviour or not, but I don't think it matters here.</div></div>