================
@@ -799,3 +799,16 @@ template auto t::operator()<int>(int a) const; //
expected-note {{in instantiati
}
#endif
+
+namespace GH180460 {
+// Trailing return type incorrectly treated 'x' as mutable.
+void test_lambda_return_type() {
+ float x = 0.0f;
+
+ [=]() -> decltype((x)) {
+ decltype(x) y1 = x;
+ decltype((x)) y2 = y1; // expected-note{{binding reference variable
'y2' here}}
+ return y2; // expected-warning{{reference to stack
memory associated with local variable 'y1' returned}}
+ };
+}
+}
----------------
zyn0217 wrote:
We need an empty line here
https://github.com/llvm/llvm-project/pull/180690
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits