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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The error message is obscure, but it seems what GCC has issue with here is the
use of the function parameter seq2 in the trailing return type occurring
outside of an unevaluated context.

I'm not totally sure if the testcase is valid
(https://eel.is/c++draft/basic.scope.param#note-1 might suggest it's not?), but
one workaround is to replace the use of seq2 in the trailing return type with
decltype(seq2){} (which works because index_sequence is an empty type).

Here's a minimal testcase demonstrating the issue

  struct empty { };
  constexpr int f(empty) { return 0; }
  template<int> struct A { };
  auto g(empty e) -> A<f(e)>;

which is rejected with

  error: use of parameter outside function body before ‘)’ token

due to 'e' being used outside of an unevaluated context within the signature of
the function.

Reply via email to