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

            Bug ID: 61814
           Summary: [c++1y] cannot use decltype on captured arg-pack
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tongari95 at gmail dot com

The code below has a lambda that captures the outer params t, for forwarding
matter, decltype on t has to be used.
```
    auto const pack = [](auto&&... t)
    {
        return [&](auto&& f)->decltype(auto)
        {
            return f(static_cast<decltype(t)>(t)...);
        };
    };

    int main(int argc, char** argv) {
        pack(1)([](int){});
        return 0;
    }
```
It works with clang 3.5, but g++ 4.9.0 complains:
error: 't' was not declared in this scope

The same also applies to `sizeof` or that kind of compile-time thing.

Reply via email to