Bug 84337 - Variadic expansion is accepted on not parameter pack template argument
Summary: Variadic expansion is accepted on not parameter pack template argument
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2018-02-12 13:56 UTC by Benjamin Buch
Modified: 2021-05-18 20:00 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Buch 2018-02-12 13:56:46 UTC
template < typename T > void f(T ...){}

int main(){
    f(0);
}


T is not an parameter pack, but expansion is wrongly accepted.


$ g++ -std=c++11 main.cpp
$ g++ --version
g++ (GCC) 8.0.1 20180212 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-6 --version
g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++-5 --version
g++-5 (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 1 Jonathan Wakely 2021-05-18 20:00:12 UTC
That's not a pack expansion, that's a printf-style varargs function. The comma before the ellipsis is optional.