[gcc(refs/users/ppalka/heads/libstdcxx-constrained-algos)] PR c++/92531 - ICE with noexcept(lambda).

Patrick Palka ppalka@gcc.gnu.org
Fri Jan 17 21:42:00 GMT 2020


https://gcc.gnu.org/g:eff9c61dfb082cb3ea26f354d795e4098ec76866

commit eff9c61dfb082cb3ea26f354d795e4098ec76866
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jan 17 08:37:49 2020 -0500

    PR c++/92531 - ICE with noexcept(lambda).
    
    This was failing because uses_template_parms didn't recognize LAMBDA_EXPR as
    a kind of expression.  Instead of trying to enumerate all the different
    varieties of expression and then aborting if what's left isn't
    error_mark_node, let's handle error_mark_node and then assume anything else
    is an expression.
    
    	* pt.c (uses_template_parms): Don't try to enumerate all the
    	expression cases.

Diff:
---
 gcc/cp/ChangeLog                                |  6 ++++++
 gcc/cp/pt.c                                     | 17 +++--------------
 gcc/testsuite/g++.dg/cpp1z/constexpr-lambda25.C |  7 +++++++
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d76675e..62d8acf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-17  Jason Merrill  <jason@redhat.com>
+
+	PR c++/92531 - ICE with noexcept(lambda).
+	* pt.c (uses_template_parms): Don't try to enumerate all the
+	expression cases.
+
 2020-01-17  Jakub Jelinek  <jakub@redhat.com>
 
 	PR c++/93228
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 872f8ff..1b3d07b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10537,22 +10537,11 @@ uses_template_parms (tree t)
 		   || uses_template_parms (TREE_CHAIN (t)));
   else if (TREE_CODE (t) == TYPE_DECL)
     dependent_p = dependent_type_p (TREE_TYPE (t));
-  else if (DECL_P (t)
-	   || EXPR_P (t)
-	   || TREE_CODE (t) == TEMPLATE_PARM_INDEX
-	   || TREE_CODE (t) == OVERLOAD
-	   || BASELINK_P (t)
-	   || identifier_p (t)
-	   || TREE_CODE (t) == TRAIT_EXPR
-	   || TREE_CODE (t) == CONSTRUCTOR
-	   || CONSTANT_CLASS_P (t))
+  else if (t == error_mark_node)
+    dependent_p = false;
+  else
     dependent_p = (type_dependent_expression_p (t)
 		   || value_dependent_expression_p (t));
-  else
-    {
-      gcc_assert (t == error_mark_node);
-      dependent_p = false;
-    }
 
   processing_template_decl = saved_processing_template_decl;
 
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda25.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda25.C
new file mode 100644
index 0000000..74db03f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda25.C
@@ -0,0 +1,7 @@
+// PR c++/92531
+// { dg-do compile { target c++17 } }
+
+template <typename XK>
+void ky () noexcept ([]{}); // IFNDR
+// Optional error: void(*)() to bool conv in converted constant expression
+// { dg-prune-output "converted constant expression" }



More information about the Gcc-cvs mailing list