I'm applying your patch with some tweaks.
First, I shortened your subject line; we try to keep them under 50 chars
so they look good in git log --oneline. Going over isn't a big deal,
but that's the goal.
On 6/23/20 3:47 PM, Nicholas Krause wrote:
From: Nicholas Krause <xerofo...@gmail.com>
This fixes 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. In v2, add the missing required
test case for all new patches. v3 Fixes both the test case to compile in
C++11 mode and the message to print out only the type. v4 fixes the testcase
to only target C++11. v5 and v6 fix the test case properly. v7 fixes running
the testcase. v8 fixes grammar errors. Tested on powerpc64le-unknown-linux-gnu.
gcc/cp/ChangeLog:
A PR number goes before the change description, like
PR c++/95672
* typeck2.c (cxx_incomplete_type_diagnostic):
Add missing TYPE_EXPANSION_PACK check for
diagnosing incomplete types in
cxx_incomplete_type_diagnostic to fix
c++/PR95672.
Not here. Also, your later lines should line up with the *, not the t.
gcc/testsuite/ChangeLog:
* g++.dg/template/PR95672.C: New test.
I renamed the testcase to use lowercase "pr" to match other tests.
Signed-off-by: Nicholas Krause <xerofo...@gmail.com>
---
gcc/cp/typeck2.c | 5 +++++
gcc/testsuite/g++.dg/template/PR95672.C | 2 ++
2 files changed, 7 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/template/PR95672.C
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 5fd3b82fa89..dac135a2e11 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 use of pack expansion %qT", type);
+ break;
+
case TYPENAME_TYPE:
case DECLTYPE_TYPE:
emit_diagnostic (diag_kind, loc, 0,
diff --git a/gcc/testsuite/g++.dg/template/PR95672.C
b/gcc/testsuite/g++.dg/template/PR95672.C
new file mode 100644
index 00000000000..104e125287f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/PR95672.C
@@ -0,0 +1,2 @@
And I added the PR number within the file as well.
+// { dg-do compile { target c++14 } }
+struct g_class : decltype (auto) ... { }; // { dg-error "invalid use of pack
expansion" }
So here's what I'm applying. Thanks for the patch!
Jason
commit a11dd6a7605fae2c2a9941ce3e749349a468a73c
Author: Nicholas Krause <xerofo...@gmail.com>
Date: Tue Jun 23 15:47:37 2020 -0400
c++: Handle bad pack expansion in base list. [PR96752]
This fixes 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.
Tested on powerpc64le-unknown-linux-gnu.
gcc/cp/ChangeLog:
PR c++/95672
* typeck2.c (cxx_incomplete_type_diagnostic): Add missing
TYPE_EXPANSION_PACK check for diagnosing incomplete types in
cxx_incomplete_type_diagnostic.
gcc/testsuite/ChangeLog:
PR c++/95672
* g++.dg/template/pr95672.C: New test.
Signed-off-by: Nicholas Krause <xerofo...@gmail.com>
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 5fd3b82fa89..dac135a2e11 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 use of pack expansion %qT", type);
+ break;
+
case TYPENAME_TYPE:
case DECLTYPE_TYPE:
emit_diagnostic (diag_kind, loc, 0,
diff --git a/gcc/testsuite/g++.dg/template/pr95672.C b/gcc/testsuite/g++.dg/template/pr95672.C
new file mode 100644
index 00000000000..c752b4a2c08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr95672.C
@@ -0,0 +1,3 @@
+// PR c++/95672
+// { dg-do compile { target c++14 } }
+struct g_class : decltype (auto) ... { }; // { dg-error "invalid use of pack expansion" }