tzik added a comment.

In https://reviews.llvm.org/D47067#1116733, @rsmith wrote:

> 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.


Thanks for your investigation!
I thought that's covered by Scope::setNRVOCandidate with a null `Candidate`. As 
`t` is not marked as an NRVO variable before its instantiation. There's likely 
something I missed that turn the flag on while its instantiation.


Repository:
  rC Clang

https://reviews.llvm.org/D47067



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to