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

--- Comment #42 from Boris Staletic <boris.staletic at protonmail dot com> ---
Created attachment 62890
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62890&action=edit
pack expansion containing a splice expression, containing a range indexed by a
pack of size_t

Without `static` in `types` declaration, the error is:

```
foo.cpp:6:18: error: use of local variable with automatic storage from
containing function [-Wtemplate-body]
    6 |     [](typename[:types[Is]:]... args) {};
      |                  ^~~~~
foo.cpp:5:31: note: 'constexpr const std::meta::info types [1]' declared here
    5 |     constexpr std::meta::info types[]{^^int};
      |                               ^~~~~
foo.cpp:6:29: error: reflection not usable in a splice type before '...' token
[-Wtemplate-body]
    6 |     [](typename[:types[Is]:]... args) {};
      |                             ^~~
```

With `static` in the declaration of `types`, the error becomes

```
foo.cpp:6:33: error: expansion pattern '[: types[Is] :]' contains no parameter
packs [-Wtemplate-body]
    6 |     [](typename[:types[Is]:]... args) {};
      |                                 ^~~~
```

Reply via email to