aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-10-07 23:06:16 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-10-07 23:06:16 +0000
commita5061eed103e5e87e8416ac9e181423a8853ce0f (patch)
treec2cf834162555be1bbb9a7e9d64196509f3b95f4 /gcc
parent40c5ed5b5a7f1fc4e05c36c3f9d069467390b5d3 (diff)
downloadgcc-a5061eed103e5e87e8416ac9e181423a8853ce0f.zip
gcc-a5061eed103e5e87e8416ac9e181423a8853ce0f.tar.gz
gcc-a5061eed103e5e87e8416ac9e181423a8853ce0f.tar.bz2
re PR c++/51422 ([c++0x] ICE with invalid lambda expression)
/cp 2012-10-07 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51422 * semantics.c (is_normal_capture_proxy): Return true for error_mark_node as DECL_VALUE_EXPR. /testsuite 2012-10-07 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51422 * g++.dg/cpp0x/lambda/lambda-ice8.C: New. From-SVN: r192187
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C10
4 files changed, 26 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 458b762..0113fa4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-10-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51422
+ * semantics.c (is_normal_capture_proxy): Return true for
+ error_mark_node as DECL_VALUE_EXPR.
+
2012-10-05 Jakub Jelinek <jakub@redhat.com>
* cp-tree.h (SIZEOF_EXPR_TYPE_P): Define.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 17ac36f..7174927 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3,8 +3,7 @@
building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2012 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
@@ -9005,14 +9004,15 @@ is_capture_proxy (tree decl)
bool
is_normal_capture_proxy (tree decl)
{
- tree val;
-
if (!is_capture_proxy (decl))
/* It's not a capture proxy. */
return false;
/* It is a capture proxy, is it a normal capture? */
- val = DECL_VALUE_EXPR (decl);
+ tree val = DECL_VALUE_EXPR (decl);
+ if (val == error_mark_node)
+ return true;
+
gcc_assert (TREE_CODE (val) == COMPONENT_REF);
val = TREE_OPERAND (val, 1);
return DECL_NORMAL_CAPTURE_P (val);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 32576db..a1c4a32 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51422
+ * g++.dg/cpp0x/lambda/lambda-ice8.C: New.
+
2012-10-07 Richard Sandiford <rdsandiford@googlemail.com>
Sandra Loosemore <sandra@codesourcery.com>
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C
new file mode 100644
index 0000000..00078d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C
@@ -0,0 +1,10 @@
+// PR c++/51422
+// { dg-do compile { target c++11 } }
+
+template<typename> struct A {};
+
+void foo()
+{
+ [i] { A<decltype(i)>(); }; // { dg-error "not declared|invalid" }
+ [i] { A<decltype(i)>(); }; // { dg-error "invalid" }
+}