rsmith added a comment.
Slightly reduced testcase:
template<typename T> T f(T u, bool b) {
T t;
if (b) return t;
return u;
}
struct X { X(); X(const X&); ~X(); void *data; };
template X f(X, bool);
... which compiles to:
X f(X u, bool b) {
X::X(&return-slot);
if (b) return;
X::X(&return-slot, u);
X::~X(&return-slot);
}
... due to `t` incorrectly being used as an NRVO variable.
Repository:
rC Clang
https://reviews.llvm.org/D47067
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits