Issue 95280
Summary [C++] NRVO doesn't elide move when return type is a placeholder in a function template
Labels new issue
Assignees
Reporter MitalAshok
    Looking at the assembly output for this <https://godbolt.org/z/6eG7TWvvd>:

```c++
struct test {
 test();
    test(test&&);
};

auto f1() {
    test t;
 return t;
}

template<typename = void>
auto f2() {
    test t;
    return t;
}

template<typename = void>
test f3() {
 test t;
    return t;
}

template auto f2();
template test f3();
```

Shows that the move is elided in `f1` and `f3`, but not in `f2`. This also happens if the placeholder is `decltype(auto)`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to