[PATCH] Handle TYPE_PACK_EXPANSION in cxx_incomplete_type_diagnostic

Nicholas Krause xerofoify@gmail.com
Fri Jun 19 18:39:25 GMT 2020


This fixs the PR95672 by adding the missing TYPE_PACK_EXPANSION case in
cxx_incomplete_type_diagnostic in order to avoid ICES on diagnosing
incomplete template pack expansion cases.
Signed-off-by: Nicholas Krause <xerofoify@gmail.com>

Changelog:
*cp/type2ck.c: Add missing case TYPE_PACK_EXPANSION for diagnosticing
incomplete parameter pack expansion in cxx_incomplete_type_diagnostic
in order to avoid ICEing here.
---
 gcc/cp/typeck2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 5fd3b82..dc5bd5e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -552,6 +552,11 @@ cxx_incomplete_type_diagnostic (location_t loc, const_tree value,
 		       TYPE_NAME (type));
       break;
 
+    case TYPE_PACK_EXPANSION:
+     emit_diagnostic(diag_kind, loc, 0,
+		     "invalid expansion of template expansion parameter %qT",
+		      PACK_EXPANSION_PATTERN(type));
+      break;
     case TYPENAME_TYPE:
     case DECLTYPE_TYPE:
       emit_diagnostic (diag_kind, loc, 0,
-- 
1.8.3.1



More information about the Gcc-patches mailing list