]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/82293 (ICE in nonlambda_method_basetype at gcc/cp/lambda.c:886)
authorPaolo Carlini <paolo@gcc.gnu.org>
Wed, 29 Nov 2017 21:54:18 +0000 (21:54 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 29 Nov 2017 21:54:18 +0000 (21:54 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C [new file with mode: 0644]

index 1bc460002ddf5fe76500ee294ac2b8e753aa8671..f9fdf1b91d4dac5b048790e13429d5d920de8be2 100644 (file)
@@ -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.
index 8b8c1274bc6263f8e517e85861d8de2a039662f7..c06f4415ebd5d4a9e1798a9937f941dd97c84a98 100644 (file)
@@ -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.  */
index d2fc4c07585d95036c440cb07dcf6287d1ea4faf..f65c3d916b6476a480ba29385187f2eabc7c1c81 100644 (file)
@@ -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 (file)
index 0000000..2f42d71
--- /dev/null
@@ -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;
+}
This page took 0.103439 seconds and 5 git commands to generate.