re PR c++/82570 (Lambda fails to compile because it doesn't meet constexpr requirements)
2017-10-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82570 * g++.dg/cpp1z/constexpr-lambda18.C: New. From-SVN: r253806
This commit is contained in:
parent
49dcd8a45a
commit
54a3b395e0
2 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2017-10-17 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/82570
|
||||
* g++.dg/cpp1z/constexpr-lambda18.C: New.
|
||||
|
||||
2017-10-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/82549
|
||||
|
|
30
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C
Normal file
30
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C
Normal file
|
@ -0,0 +1,30 @@
|
|||
// PR c++/82570
|
||||
// { dg-options "-std=c++17" }
|
||||
|
||||
template< typename Body >
|
||||
inline void iterate(Body body)
|
||||
{
|
||||
body(10);
|
||||
}
|
||||
|
||||
template< typename Pred >
|
||||
inline void foo(Pred pred)
|
||||
{
|
||||
iterate([&](int param)
|
||||
{
|
||||
if (pred(param))
|
||||
{
|
||||
unsigned char buf[4];
|
||||
buf[0] = 0;
|
||||
buf[1] = 1;
|
||||
buf[2] = 2;
|
||||
buf[3] = 3;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
foo([](int x) { return x > 0; });
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue