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

            Bug ID: 124600
           Summary: [rejects-valid] pack expansion of function types with
                    conditional noexcept clauses
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

clang accepts the following code, gcc rejects it:


    template <class... Fns>
    struct var_fun_test;

    template <class... Ret, class... Arg, bool... Noexcept>
    struct var_fun_test<Ret(Arg) noexcept(Noexcept)...>
    {};

    int main()
    {
      auto c = var_fun_test<void(int), void(int) noexcept>();
    }

error:

    <source>:6:43: error: parameter packs not expanded with '...':
        6 |     struct test<Ret(Arg) noexcept(Noexcept)...>
          |                                           ^
    <source>:6:43: note:         'Noexcept'
    <source>:6:12: error: template parameters not deducible in partial
specialization:
        6 |     struct test<Ret(Arg) noexcept(Noexcept)...>
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <source>:6:12: note:         'Noexcept'


i think the error about 'Noexcept' not being deducible is a red herring because
gcc gladly accepts the following:


    template <class Fn>
    struct fun_test;

    template <class Ret, class Arg, bool Noexcept>
    struct fun_test<Ret(Arg) noexcept(Noexcept)>
    {};

    int main()
    {
      auto a = fun_test<void(int)>();
      auto b = fun_test<void(int) noexcept>();
    }

See: https://godbolt.org/z/czWT9jnPx
  • [Bug c++/124600] New: [rejects-... eric.niebler at gmail dot com via Gcc-bugs

Reply via email to