This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/85093] New: wrong number of template arguments does not trigger error when one argument is variadic
- From: "spambox3 at fangwolg dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 27 Mar 2018 13:48:49 +0000
- Subject: [Bug c++/85093] New: wrong number of template arguments does not trigger error when one argument is variadic
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85093
Bug ID: 85093
Summary: wrong number of template arguments does not trigger
error when one argument is variadic
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: spambox3 at fangwolg dot de
Target Milestone: ---
Created attachment 43769
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43769&action=edit
preprocessed example demonstrating the issue
The attached short example code passes two template arguments into a template
defined with one non-variadic template parameters. Although it should be
illegal code, it does not trigger an error with a recent gcc version. The
second (superfluous) template argument is given by a non-empty variadic
template parameter of another class.
the commandline
g++ --std=c++11 --save-temps bla.cc
finishes without error with gcc 7.2.0.
Using gcc 4.9.2 on the other hand aborts with the expected error
bla.cc:4:19: error: wrong number of template arguments (2, should be 1)
typedef A<V,G...> AB;
^
bla.cc:1:25: error: provided for 'template<class V> class A'
template<class V> class A {};
clang 5.0.0 also reports an error.
here is the source code:
template<class V> class A {};
template<class V, class... G> class B {
typedef A<V,G...> AB;
AB ab;
};
int main() {
B<int,double> b;
}