public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61814] New: [c++1y] cannot use decltype on captured arg-pack
@ 2014-07-15 15:44 tongari95 at gmail dot com
  2014-10-23 12:23 ` [Bug c++/61814] " oakad at yahoo dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tongari95 at gmail dot com @ 2014-07-15 15:44 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-23 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 15:44 [Bug c++/61814] New: [c++1y] cannot use decltype on captured arg-pack tongari95 at gmail dot com
2014-10-23 12:23 ` [Bug c++/61814] " oakad at yahoo dot com
2014-10-23 12:29 ` redi at gcc dot gnu.org
2014-10-23 12:39 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).