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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to