aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-04-27 17:21:35 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-04-27 17:21:35 -0400
commit95b24c84c3d66cba21214df45e041ed9a8bd6be1 (patch)
tree58660f2f4b59b74e52ea1598ba2b17a1cca8d99b /gcc
parent60bfcbecc694c8a4d8e133fd31596955e69988e2 (diff)
downloadgcc-95b24c84c3d66cba21214df45e041ed9a8bd6be1.zip
gcc-95b24c84c3d66cba21214df45e041ed9a8bd6be1.tar.gz
gcc-95b24c84c3d66cba21214df45e041ed9a8bd6be1.tar.bz2
re PR c++/43875 ([C++0x] ICE on invalid lambda return)
PR c++/43875 * semantics.c (lambda_return_type): Complain about braced-init-list. From-SVN: r158805
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/semantics.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C7
4 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 68c6b49..0e1538c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2010-04-27 Jason Merrill <jason@redhat.com>
+ PR c++/43875
+ * semantics.c (lambda_return_type): Complain about
+ braced-init-list.
+
PR c++/43790
* tree.c (cv_unqualified): Handle error_mark_node.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ea01eb3..05c5168 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5521,6 +5521,11 @@ tree
lambda_return_type (tree expr)
{
tree type;
+ if (BRACE_ENCLOSED_INITIALIZER_P (expr))
+ {
+ warning (0, "cannot deduce lambda return type from a braced-init-list");
+ return void_type_node;
+ }
if (type_dependent_expression_p (expr))
{
type = cxx_make_type (DECLTYPE_TYPE);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4a8fb18..0746e59 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/43875
+ * g++.dg/cpp0x/lambda/lambda-deduce2.C: New.
+
2010-04-27 Manuel López-Ibáñez <manu@gcc.gnu.org>
Jan Hubicka <hubicka@ucw.cz>
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
new file mode 100644
index 0000000..718d49c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
@@ -0,0 +1,7 @@
+// PR c++/43875
+// { dg-options "-std=c++0x" }
+
+int main()
+{
+ auto x2 = []{ return { 1, 2 }; }; // { dg-message "return" }
+}