http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47326

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-08 
14:30:36 UTC ---
The code is valid C++0x (so the summary should include [C++0x])

It doesn't ICE if sizeof...(_ARGS) is used instead of sizeof...(args), or if
the sizeof... expression occurs in the function body rather than the
trailing-return-type

e.g this compiles:

template <int> struct A { };

template <typename... _ARGS>
auto f (_ARGS... args) -> A<sizeof...(_ARGS)> {
  return {};
}

int main() {
  f(1,2);
}

and so does this:

template <int> struct A { };

template <typename... _ARGS>
A<2> f (_ARGS... args) {
  return A<sizeof...(args)>{};
}

int main() {
  f(1,2);
}

but not this:

template <int> struct A { };

template <typename... _ARGS>
auto f (_ARGS... args) -> A<sizeof...(args)> {
  return {};
}

int main() {
  f(1,2);
}

Reply via email to