Unsafe example.

This commit is contained in:
Anthony Calandra
2016-11-01 22:35:11 -07:00
parent 54a50ab725
commit 168620e99e

View File

@@ -348,8 +348,9 @@ auto& f(T& t) {
return t;
}
auto g = [](auto x) -> auto& { return f(x); };
int& y = g(123); // reference to `x`
auto g = [](auto& x) -> auto& { return f(x); };
int y = 123;
int& z = g(y); // reference to `y`
```
### decltype(auto)