// DR 2032 - Default template-arguments of variable templates // [temp.param]/14: If a template-parameter of a class template, variable // template, or alias template has a default template-argument, each subsequent // template-parameter shall either have a default template-argument supplied or // be a template parameter pack. template<typename T = int, typename U> // error T vt; // [temp.param]/14: If a template-parameter of a primary class template, // primary variable template, or alias template is a template parameter pack, // it shall be the last template-parameter. template<typename... Ts, typename U> // error int vt2; Here we should give two errors under DR 2032, but we only give the first one.
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:50bee766bc9f4020cf1f814178155d16e80dccaa commit r11-2521-g50bee766bc9f4020cf1f814178155d16e80dccaa Author: Marek Polacek <polacek@redhat.com> Date: Thu Jul 16 09:15:37 2020 -0400 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.
Fixed.