Itanium ABI updated regarding returning non-trivially moveable types

This is relevant to


This means that clang does the wrong thing according to the ABI as well as the C++ standard for this program:

#include <stdio.h>

struct S {
int i;
S(S*& p) { printf(“S(): %p\n”, this); p = this; }
S(S const&) = delete;

S get_s(S*& p) { return S(p); }

int main() {
S* p;
S s = get_s(p);
printf(" &s: %p\n", &s);
printf(" p: %p\n", p);
printf("%s\n", &s == p ? “same” : “different”);

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.