aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2017-11-29 21:54:18 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-11-29 21:54:18 +0000
commitcc6fe784486b77d96bd4cb9cb1d6556c1d5480fb (patch)
treeedced92b46072cae0548f7af7900988498be436a /gcc
parente3704417fa5e3ab896ae766087783b098a2f2f8f (diff)
downloadgcc-cc6fe784486b77d96bd4cb9cb1d6556c1d5480fb.zip
gcc-cc6fe784486b77d96bd4cb9cb1d6556c1d5480fb.tar.gz
gcc-cc6fe784486b77d96bd4cb9cb1d6556c1d5480fb.tar.bz2
re PR c++/82293 (ICE in nonlambda_method_basetype at gcc/cp/lambda.c:886)
/cp 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82293 * lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P on a null type. /testsuite 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82293 * g++.dg/cpp0x/lambda/lambda-ice24.C: New. From-SVN: r255254
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/lambda.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C12
4 files changed, 25 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1bc4600..f9fdf1b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/82293
+ * lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P
+ on a null type.
+
2017-11-29 Jason Merrill <jason@redhat.com>
PR c++/82760 - memory corruption with aligned new.
@@ -12,7 +18,7 @@
(note_break_stmt, note_iteration_stmt_body_start,
note_iteration_stmt_body_end): Declare.
* decl.c (struct cp_switch): Add has_default_p, break_stmt_seen_p
- and in_loop_body_p fields.
+ and in_loop_body_p fields.
(push_switch): Clear them.
(pop_switch): Set SWITCH_STMT_CANNOT_FALLTHRU_P if has_default_p
and !break_stmt_seen_p. Assert in_loop_body_p is false.
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 8b8c127..c06f441 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -920,7 +920,7 @@ nonlambda_method_basetype (void)
return NULL_TREE;
type = current_class_type;
- if (!LAMBDA_TYPE_P (type))
+ if (!type || !LAMBDA_TYPE_P (type))
return type;
/* Find the nearest enclosing non-lambda function. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d2fc4c0..f65c3d9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-29 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/82293
+ * g++.dg/cpp0x/lambda/lambda-ice24.C: New.
+
2017-11-29 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/fold-vec-ld-char.c: Add lxv to expected output.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C
new file mode 100644
index 0000000..2f42d71
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C
@@ -0,0 +1,12 @@
+// PR c++/82293
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wshadow" }
+
+template <typename>
+struct S {
+ int f{[this](){return 42;}()};
+};
+
+int main(){
+ return S<int>{}.f;
+}