[Bug c++/95287] New: Incorrect default argument checking for specializations of functions with parameter packs

raul at tambre dot ee gcc-bugzilla@gcc.gnu.org
Sat May 23 12:34:30 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95287

            Bug ID: 95287
           Summary: Incorrect default argument checking for
                    specializations of functions with parameter packs
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raul at tambre dot ee
  Target Milestone: ---

template<class... Ts>
void j(int i = 0, Ts... ts) {}

template<>
void j<int>(int i, int j) {}

Fails to compile with:

<source>:5:24: error: default argument missing for parameter 2 of 'void j(int,
Ts ...) [with Ts = {int}]'

    5 | void j<int>(int i, int j) {}

      |                    ~~~~^

<source>:5:17: note: ...following parameter 1 which has a default argument

    5 | void j<int>(int i, int j) {}

      |             ~~~~^

This is valid code.
Possibly related to DR2233[0], which supersedes DR777[1].

MSVC and ICC accept this code.
Clang has a patch in review to implement DR2233[2].

[0] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2233
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#777
[2] https://reviews.llvm.org/D79800


More information about the Gcc-bugs mailing list