aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-11-09 09:09:12 -0500
committerPatrick Palka <ppalka@redhat.com>2021-11-09 09:09:12 -0500
commita19f09cb03d7f69377e6d12162e5d6df78a82849 (patch)
tree67a56c1059dd4d0693ce007d65b4c69331e90adf /gcc/cp/pt.c
parent0dc0947d4b67af66a57f4824232bb8020b0403f7 (diff)
downloadgcc-a19f09cb03d7f69377e6d12162e5d6df78a82849.zip
gcc-a19f09cb03d7f69377e6d12162e5d6df78a82849.tar.gz
gcc-a19f09cb03d7f69377e6d12162e5d6df78a82849.tar.bz2
c++: unexpanded pack in var tmpl partial spec [PR100652]
Here we're failing to spot a bare parameter pack appearing in the argument list of a variable template partial specialization because we only look for them within the decl's TREE_TYPE, which is sufficient for class templates but not for variable templates. PR c++/100652 gcc/cp/ChangeLog: * pt.c (push_template_decl): Check for bare parameter packs in the argument list of a variable template partial specialization. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ69.C: New test.
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2638d3c..b2916f8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5877,12 +5877,19 @@ push_template_decl (tree decl, bool is_friend)
if (check_for_bare_parameter_packs (TYPE_RAISES_EXCEPTIONS (type)))
TYPE_RAISES_EXCEPTIONS (type) = NULL_TREE;
}
- else if (check_for_bare_parameter_packs (is_typedef_decl (decl)
- ? DECL_ORIGINAL_TYPE (decl)
- : TREE_TYPE (decl)))
+ else
{
- TREE_TYPE (decl) = error_mark_node;
- return error_mark_node;
+ if (check_for_bare_parameter_packs (is_typedef_decl (decl)
+ ? DECL_ORIGINAL_TYPE (decl)
+ : TREE_TYPE (decl)))
+ {
+ TREE_TYPE (decl) = error_mark_node;
+ return error_mark_node;
+ }
+
+ if (is_partial && VAR_P (decl)
+ && check_for_bare_parameter_packs (DECL_TI_ARGS (decl)))
+ return error_mark_node;
}
if (is_partial)