aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-07-16 09:15:37 -0400
committerMarek Polacek <polacek@redhat.com>2020-08-03 17:43:05 -0400
commit50bee766bc9f4020cf1f814178155d16e80dccaa (patch)
treeda6017acebc2d48197ef88ff2254c624160cb003 /gcc/cp
parent90b43856fdff7d96d93d22970eca8a86c56e0ddc (diff)
downloadgcc-50bee766bc9f4020cf1f814178155d16e80dccaa.zip
gcc-50bee766bc9f4020cf1f814178155d16e80dccaa.tar.gz
gcc-50bee766bc9f4020cf1f814178155d16e80dccaa.tar.bz2
c++: Variable template and template parameter pack [PR96218]
This is DR 2032 which says that the restrictions regarding template parameter packs and default arguments apply to variable templates as well, but we weren't detecting that. gcc/cp/ChangeLog: DR 2032 PR c++/96218 * pt.c (check_default_tmpl_args): Also consider variable templates. gcc/testsuite/ChangeLog: DR 2032 PR c++/96218 * g++.dg/cpp1y/var-templ67.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 72bdf86..bd2af8b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5482,14 +5482,15 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
/* Don't complain about an enclosing partial
specialization. */
&& parm_level == parms
- && TREE_CODE (decl) == TYPE_DECL
+ && (TREE_CODE (decl) == TYPE_DECL || VAR_P (decl))
&& i < ntparms - 1
&& template_parameter_pack_p (TREE_VALUE (parm))
/* A fixed parameter pack will be partially
instantiated into a fixed length list. */
&& !fixed_parameter_pack_p (TREE_VALUE (parm)))
{
- /* A primary class template can only have one
+ /* A primary class template, primary variable template
+ (DR 2032), or alias template can only have one
parameter pack, at the end of the template
parameter list. */