commit b5c0742c0bfe7fe58dba443d47f880c26eea1b82
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jul 5 01:13:04 2011 -0400
PR c++/49598
* semantics.c (finish_id_expression): convert_from_reference.
@@ -2942,7 +2942,7 @@ finish_id_expression (tree id_expression,
tree containing_function = current_function_decl;
tree lambda_stack = NULL_TREE;
tree lambda_expr = NULL_TREE;
- tree initializer = decl;
+ tree initializer = convert_from_reference (decl);
/* Core issue 696: "[At the July 2009 meeting] the CWG expressed
support for an approach in which a reference to a local
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/49598
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+int
+main()
+{
+ int i = 10;
+ int& ir = i;
+
+ if ([=]{ return ir; }() != 10)
+ return 1;
+}