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

            Bug ID: 68342
           Summary: Unexpected expansion pattern contains no argument
                    packs error
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com
  Target Milestone: ---

Created attachment 36704
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36704&action=edit
The code which produces the unexpected error

The C++11 code below unexpectedly fails to compile on 64-bit Ubuntu 15.04 using
g++ (GCC) 6.0.0 20151110 (experimental) with the following message:

nullary.cpp:12:27: error: expansion pattern ‘g<vec>(xs#0)’ contains no argument
packs
   using r_t  = decltype(mt(g(x),g(xs)...))

It compiles with Clang 3.8.0.

struct vec { int x; };

template <typename T>
int g(T y) { return y.x; }

template <typename ...Ts>
int mt(Ts ...xs){ return 0; }

template <typename T, typename ...Ts>
void quack(T x, Ts ...xs)
{
  using r_t  = decltype(mt(g(x),g(xs)...));
  auto f = []() { return r_t{}; };
}

int main(int argc, char *argv[])
{
  quack(vec{0},vec{0},vec{0});
  return 0;
}

Reply via email to