Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 419934 Details for
Bug 568908
[ICE/5.3] sys-devel/gcc-5.3.0: internal compiler error: in create_tmp_var, at gimple-expr.c:519
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
This is the source that was being compiled.
lambda.cpp (text/x-c++src), 1.58 KB, created by
Hunter L. Allen
on 2015-12-20 19:47:39 UTC
(
hide
)
Description:
This is the source that was being compiled.
Filename:
MIME Type:
Creator:
Hunter L. Allen
Created:
2015-12-20 19:47:39 UTC
Size:
1.58 KB
patch
obsolete
>#include <iostream> >#include <algorithm> >#include <functional> >#include <typeinfo> > >auto generic_lambda = [](auto a, auto && b) { return a < b; }; > >/** > * That lambda is kinda boring. We can do better! How about > * arbitrary numbers of parameters? > */ > >auto vglambda = [] (auto printer) { > /** > * What's interesting about this line? > * It knows how to print ANYTHING. And, > * additionally, it can print ALL THE THINGS. > */ > return [=] (auto && ... ts) { > printer(std::forward<decltype(ts)>(ts) ...); > > //! This is a nullary lambda. nullary lambdas take no > //! parameters. > return [=] { printer(ts ...); }; > }; >}; > >/** > * @brief This is a lambda expression that prints > * and calculates fibonacci numbers. > * > * @param[in] number Number of fibonacci numbers to calculate > * > * @return That's a good question, actually... > */ >auto fib_lambda = [] (unsigned int number) { > auto f1 = 1u; > auto f2 = 0u; > > auto fib([&f1, &f2] () mutable -> auto { > //! why are all of these auto? Because auto is a > //! shorter word than "unsigned int." ... And it's cool. > auto temp = f1; > f1 = f2; > f2 += temp; > auto p = vglambda([=](auto f) { std::cout << f2 << std::endl; }); > p(f2); > return f2; > }); > for (; number--; ) fib(); > return number; >}; > >int main (int argc, char ** argv) { > auto p = vglambda([](auto v1, auto v2, auto v3) { std::cout << v1 << std::endl > << v2 << std::endl > << v3 << std::endl; }); > auto q = p(1, 'a', 3.14); > auto r = p(std::string("I am a standard string!"), "I'm a string literal.", "\n"); > q(); > auto fib = fib_lambda(40); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 568908
: 419934