public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64488] New: [4.9/5.0][c++11] Expand initializer list with lambdas in variadic template. Reject valid code.
@ 2015-01-04 16:00 reagentoo at gmail dot com
  2015-01-04 16:10 ` [Bug c++/64488] " redi at gcc dot gnu.org
  2015-01-04 16:12 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: reagentoo at gmail dot com @ 2015-01-04 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64488
           Summary: [4.9/5.0][c++11] Expand initializer list with lambdas
                    in variadic template. Reject valid code.
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reagentoo at gmail dot com

The following valid code snippet (compiled with "-std=c++11") rejected in GCC
5.0.0 (20150103) but compiles with Clang normal:
=======================================================
#include <iostream>

template <int _i>
struct Lmb
{
    static void fff() { std::cout << _i << std::endl; }
};

template <int... _is>
struct Expand
{
    Expand() { }

    static constexpr uint m_size = sizeof...(_is);

    static void (*const m_arr[m_size])();
};
template <int... _is>
void (*const Expand<_is...>::m_arr[m_size])() = {
        [] () { std::cout << _is << std::endl; } ...
        //Lmb<_is>::fff...
};


int main()
{
    Expand<12,34,56> e;
    e.m_arr[0]();
    e.m_arr[1]();
    e.m_arr[2]();

    return 24;
}
=======================================================
GCC 5.0.0 (20150103) output:
-------------------------------------------------------
prog.cc: In lambda function:
prog.cc:20:46: error: parameter packs not expanded with '...':
        [] () { std::cout << _is << std::endl; } ...
                                             ^
prog.cc:20:46: note:         '_is'
prog.cc: At global scope:
prog.cc:20:50: error: expansion pattern '<lambda>' contains no argument packs
        [] () { std::cout << _is << std::endl; } ...
                                                 ^


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

end of thread, other threads:[~2015-01-04 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-04 16:00 [Bug c++/64488] New: [4.9/5.0][c++11] Expand initializer list with lambdas in variadic template. Reject valid code reagentoo at gmail dot com
2015-01-04 16:10 ` [Bug c++/64488] " redi at gcc dot gnu.org
2015-01-04 16:12 ` 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).