[llvm-bugs] [Bug 44952] New: Clang doesn't accept default arguments followed by parameter pack
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Feb 18 09:41:32 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44952
Bug ID: 44952
Summary: Clang doesn't accept default arguments followed by
parameter pack
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: aaronpuchert at alice-dsl.net
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Clang emits an error for the following code:
template<typename... Args>
int f(int a = 5, Args... args);
int main() {
return f(1, 2, 3);
}
<source>:2:26: error: missing default argument on parameter 'args'
int f(int a = 5, Args... args);
^
<source>:5:10: note: in instantiation of function template specialization
'f<int, int>' requested here
return f(1, 2, 3);
^
But [dcl.fct.default]p4 says "In a given function declaration, each parameter
subsequent to a parameter with a default argument shall have a default argument
supplied in this or a previous declaration, unless the parameter was expanded
from a parameter pack, or shall be a function parameter pack."
So unless I'm missing something, this should be allowed.
(Reported by pftbest on IRC.)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200218/3697d7b3/attachment.html>
More information about the llvm-bugs
mailing list