plateform
stringclasses
1 value
repo_name
stringclasses
2 values
name
stringlengths
1
78
ext
stringclasses
2 values
path
stringlengths
15
1.11k
size
int64
1
8.55M
source_encoding
stringclasses
11 values
md5
stringlengths
32
32
text
stringlengths
0
8.49M
google
chromium
lambda-mixed
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mixed.C
204
utf_8
90ebff90baead81e1b40d4c1ff318052
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1, j = 2; [&i, j] () mutable -> void { i = 0; j = 0; } (); assert(i == 0); assert(j == 2); return 0; }
google
chromium
lambda-template2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
265
utf_8
0f09375281519983b536b5b4a9699d2b
// PR c++/47049 // { dg-options -std=c++0x } enum { E = 0, F = 1 }; template <int N, int M = ((N == 1) ? F : E)> class S {}; template <int N> struct T { static void foo (S<N> *p) { S<N> u; [&u] ()->bool {} (); } }; int main() { T<0>().foo(0); }
google
chromium
lambda-ns-scope
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ns-scope.C
229
utf_8
9b6f6cd67e0b6b1300ea588451c2a8c3
// { dg-options -std=c++0x } // { dg-do run } auto f = [](int i) { return i+1; }; int g(int i = [] { return 237; }()) { return i; } int main() { if (f(41) != 42) return 1; if (g() != 237) return 2; return 0; }
google
chromium
lambda-98
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-98.C
87
utf_8
d9b3b9597d3bf51088b71abd8f440104
// PR c++/46159 // { dg-options -std=c++98 } void f() { int **p = new(int(*[2])); }
google
chromium
lambda-conv2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv2.C
210
utf_8
d5bb4104e95c8d52ddef0bc24c6d6c71
// Test for conversion from stateless lambda to function pointer. // { dg-options -std=c++0x } // { dg-do run } typedef int (*pfn)(int); int main() { pfn p = [](int i) { return i-42; }; return p (42); }
google
chromium
lambda-in-class
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class.C
733
utf_8
d3c0241a3af8693d76df3d5ff0d98ea5
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> class C { private: int m_i; public: C() : m_i(-1) { //[] { this; } (); [this] () -> void { m_i = 0; } (); assert(m_i == 0); [this] () -> void { this->m_i = 1; } (); assert(m_i == 1); [&] () -> void { m_...
google
chromium
lambda-template3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template3.C
422
utf_8
d1a7c959843584d547aca49d43a2a371
// PR c++/49554 // { dg-options -std=c++0x } template<typename T> struct base { struct iterator { }; iterator begin(); }; template<typename T> class flist : public base<T> { typedef base<T> Base; typedef typename Base::iterator Base_iterator; public: void resize() { Base_iterator b = Ba...
google
chromium
lambda-capture-redundancy
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-redundancy.C
456
utf_8
54a6709d8b18aeed6f5af2f5c5e5ddda
// FDIS 5.1.2/8 // { dg-options "-pedantic-errors -std=c++0x" } struct S2 { void f(int i); }; void S2::f(int i) { [&, i]{ }; // OK [&, &i]{ }; // { dg-error "" } i preceded by & when & is the default [=, i]{ }; // { dg-error "" } i not preceded by & when = is the default [=, this]{ }; // { dg...
google
chromium
lambda-deduce2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce2.C
222
utf_8
35648461962519acd53d3cdabc2b30f9
// PR c++/43875 // { dg-options "-std=c++0x" } void f(); void f(int); int main() { auto x1 = []{ return f; }; // { dg-error "return|overloaded" } auto x2 = []{ return { 1, 2 }; }; // { dg-error "return|list" } }
google
chromium
lambda-nop
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nop.C
343
utf_8
836e2dcbfa500939dce851cb8f14b448
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1, j = 2; [i, j] () -> void {} (); assert(i == 1); assert(j == 2); [&i, &j] () -> void {} (); assert(i == 1); assert(j == 2); [] (int x) -> void {} (1); [] (int& x) -> void {} (i); [] (int x, int y) -> void {} (...
google
chromium
lambda-eh
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C
489
utf_8
4d150a5c8a885c4059815a3096459204
// Test that we properly clean up if we get an exception in the middle of // constructing the closure object. // { dg-options -std=c++0x } // This test fails because of PR 41449; it isn't a lambda issue. // { dg-do run { xfail *-*-* } } struct A { A() {} A(const A&) { throw 1; } }; int bs; struct B { B() { ++b...
google
chromium
lambda-syntax1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-syntax1.C
171
utf_8
640643ac1567d3bed56d9de137df54c8
// PR c++/46124 // { dg-options -std=c++0x } void foo() { [] () -> void (); } // { dg-error "returning a function" } // { dg-error "expected .\{" "" { target *-*-* } 4 }
google
chromium
lambda-ref
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref.C
212
utf_8
0059c3472d7a3d6ab23c7aa58857fedc
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1; float j = 2.0; [&i, &j] () -> void { i = 3; j = 4.0; } (); assert(i == 3); assert(j == 4.0); return 0; }
google
chromium
lambda-ctor-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctor-neg.C
587
utf_8
753c152bbd7cec6e90c461feb388c475
// { dg-options -std=c++0x } void f() { int i; auto lam = [i]{}; // { dg-message "" } decltype(lam) lam2 = { 1 }; // { dg-error "" "not an aggregate" } decltype(lam) lam3; // { dg-error "" "deleted default ctor" } lam3 = lam; // { dg-error "" "deleted assignment op" } } template <class T> void g(T i) { ...
google
chromium
lambda-defarg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg.C
116
utf_8
1afe0451e2ea2d9f93cd23a69d26a9e1
// { dg-options "-std=c++0x -pedantic-errors" } int main() { [](int a = 1) { return a; }(); // { dg-error "" } }
google
chromium
lambda-nested4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested4.C
153
utf_8
4615122fb4f57997484285d9f0d608b6
// PR c++/47687 // { dg-options -std=c++0x } template <class T> struct A { }; auto inl = []{ return []{}; }(); typedef decltype(inl) inlt; A<inlt> a;
google
chromium
lambda-ice4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice4.C
161
utf_8
d861ff7bb238770549f1f9ba4261c13c
// PR c++/47242 // { dg-options "-std=c++0x" } template < typename > void bar () { [i]{}; // { dg-error "declared|invalid" } } void foo () { bar<int>(); }
google
chromium
lambda-mutable
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable.C
377
utf_8
2dba4431f726bab3f01b33f5bb65624e
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1; const char* s1 = "hello"; const char* s2 = s1; [i, s2] () mutable -> void { i = 2; s2 = "world"; } (); //[i, s2] () -> void { i = 2; s2 = "world"; } (); // { dg-error: "assignment of data-member in read-only structure"...
google
chromium
lambda-capture-const-ref-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref-neg.C
280
utf_8
414981bc7d01f6877362173a78b37d06
// { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1, j = 2; const int& ci = i; [&ci, &j] () -> void { j = ci; } (); assert(i == 1); assert(j == 1); [&ci] () -> void { ci = 0; } (); // { dg-error "" "cannot assign to const int&" } return 0; }
google
chromium
lambda-this
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this.C
236
utf_8
9d002f169bdb774675b31e9a34275dfb
// Test that implicit 'this' capture works, but that it's still an rvalue. // { dg-options -std=c++0x } struct A { int i; void f() { [=] { i = 0; }; [&] { i = 0; }; [=] { this = 0; }; // { dg-error "lvalue" } } };
google
chromium
lambda-ice2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C
414
utf_8
bf1b6c7053f01afbd2723574b2bbe420
// PR c++/42083 // { dg-options "-std=c++0x" } template<typename F> decltype(F()) run(F f) // { dg-message "note" } { return f(); } int main() { auto l = []() { return 5; }; // { dg-error "lambda closure type" } run(l); // { dg-error "no match" } // { dg-message "candidate" "candidate note" { target *-*-* } ...
google
chromium
lambda-warn2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn2.C
128
utf_8
49f17d3507d303e9e38d917825416b02
// PR c++/42370 // { dg-options "-std=c++0x -Wall" } void foo() { []{ return 0; }(); } // { dg-bogus "no return statement" }
google
chromium
lambda-defarg2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg2.C
118
utf_8
7b0aad310340521d4ca9c11fd880f129
// PR c++/43886 // { dg-options -std=c++0x } void f2() { int i = 1; void g5(int = ([]{ return sizeof i; })()); }
google
chromium
lambda-this4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C
134
utf_8
f05f6091e72f7de7acb06537c63c94df
// PR c++/48523 // { dg-options -std=c++0x } template<typename> struct X { bool b; void f() { [this]{ return b; }; } };
google
chromium
lambda-uneval
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-uneval.C
222
utf_8
149cfef1943272807a39886c88fa25f1
// 5.1.2/2: A lambda-expression shall not appear in an unevaluated operand. // { dg-options "-std=c++0x" } template <class T> struct A { }; A<decltype([]{ return 1; }())> a; // { dg-error "lambda.*unevaluated context" }
google
chromium
lambda-this3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this3.C
153
utf_8
7ca436938d6d940290a229bc6528cb80
// PR c++/45520 // { dg-options -std=c++0x } struct M { int i; }; struct S { M m; void f() { auto lambda=[&](decltype(m.i) & i) { }; } };
google
chromium
lambda-this2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this2.C
251
utf_8
6b4020e6c9caeff30b83c2777ea4181f
// PR c++/43856 // Test for implicit 'this' capture via rewriting. // { dg-options "-std=c++0x" } struct S1 { int operator()(int); int i; void g(); void f() { [=]() { i; g(); S1::g(); operator()(42); }; } };
google
chromium
lambda-std-function
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C
308
utf_8
edbfa2dc925571a1d9ea613aa37a589c
// Test using std::function wrapper. // { dg-do run } // { dg-options -std=c++0x } #include <functional> typedef std::function<int()> FN; template<typename T> FN f(T fn) { return [fn]{return fn(2);}; } int main() { auto fn = f([](int i){return i*21;}); if (fn() != 42) return 1; return 0; }
google
chromium
lambda-capture-const-ref
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-capture-const-ref.C
292
utf_8
51dab2ccc004f3b91f60a7b710c8d2f0
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { int i = 1, j = 2; const int& ci = i; [&ci, &j] () -> void { j = ci; } (); assert(i == 1); assert(j == 1); //[&ci] () -> void { ci = 0; } (); { dg-error: cannot assign to const int& } return 0; }
google
chromium
lambda-copy-default
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default.C
275
utf_8
10e498fb9d230dd2843c7f8eb3be8ad3
// { dg-do run } // { dg-options "-std=c++0x" } int main() { int i; const char* s; [=] () -> void { i; s; i; s; } (); //[] () -> void { i; } (); // { dg-error: "`i' is not in scope" } //[1] () -> void {} (); // { dg-error: "expected identifier" } return 0; }
google
chromium
lambda-conv5
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv5.C
146
utf_8
73178fdf66f50afb009644ba74956729
// PR c++/45080 // { dg-options -std=c++0x } typedef void(*pfn)(); template<typename=int> void f() { pfn fn = []{}; } void test() { f(); }
google
chromium
lambda-50220
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-50220.C
144
utf_8
846e33f82f751ea2e10c6c06696b0868
// PR c++/50220 // { dg-options -std=c++0x } template<typename Foo> struct Foobar {}; void foobar(const Foobar<void>& obj) { [obj](){}(); }
google
chromium
lambda-recursive
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-recursive.C
364
utf_8
63eabf92616c986c387a2f405326647c
// { dg-do run } // { dg-options "-std=c++0x" } //#include <iostream> #include <functional> #include <cassert> int main() { std::function<int(int)> fib = [&fib] (int n) -> int { //std::cerr << "fib(" << n << ")\n"; if (n <= 2) return 1; else return fib(n-1) + fib(n-2); }; assert(fib(5) == 5...
google
chromium
lambda-qualified
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-qualified.C
209
utf_8
12e661c561e08767d0eba1cd070bbb1b
// PR c++/50089 // { dg-options -std=c++0x } struct TestBase { void foo() {} }; struct Test : TestBase { void foo() { [this]{ /*this->*/TestBase::foo(); // ICE without this-> }(); } };
google
chromium
lambda-errloc
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc.C
308
utf_8
d6b61c53f6746bab283cfde83dd61400
// Test that error messages about creating the closure object refer to // the lambda-introducer. // { dg-options -std=c++0x } struct A { A(); A(const A& a) = delete; // { dg-error "declared" } }; int main() { A ar[4][3]; [ar] { }; // { dg-error "3:" } A a; [a] { }; // { dg-error "3:" } }
google
chromium
lambda-deduce-ext-neg2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg2.C
305
utf_8
a30e26da337ef1a550b5b617672f3782
// Test that this is accepted even when pedantic now that it's part // of the standard. // { dg-options "-std=c++0x -pedantic" } bool b; template <class T> T f (T t) { [=] { return t+1; }; // OK return [=] { auto i = t+1; return i+1; }(); } int main() { if (f(1) != 3) return 1; }
google
chromium
lambda-deduce-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-neg.C
223
utf_8
82eba76ec2e19801524cdbdf3f739e37
// { dg-options "-std=c++0x" } int main() { int i = 0; int& r = [&] () { return i; } (); // { dg-error "" "invalid initialization of non-const reference of type .int&. from a temporary of type .int." } return 0; }
google
chromium
lambda-ctors
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ctors.C
234
utf_8
2e5acca3857bb2fde4b5a618482ae1c7
// { dg-options -std=c++0x } // { dg-do run } struct A { A() { } A(A&) { } A(A&&) { } }; int main() { A a; auto lam4 = [a]{}; // OK, implicit move ctor lam4(); auto lam5 = lam4; // OK, implicit copy ctor lam5(); }
google
chromium
lambda-field-names
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-field-names.C
516
utf_8
bcb561a88f61bda5399b57a2891eb5ca
// "For each entity captured by copy, an unnamed non-static data member is // declared in the closure type" -- test that there isn't a member of the // closure with the same name as the captured variable. // { dg-options -std=c++0x } template <class T> struct A: public T { A(T t): T(t) { } int f() { return this->...
google
chromium
lambda-copy
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy.C
272
utf_8
b1c1e52e0801a7824f271190fd4094e7
// { dg-do run } // { dg-options "-std=c++0x" } int main() { int i; const char* s; [i, s] () -> void { i; s; } (); //[] () -> void { i; } (); // { dg-error: "`i' is not in scope" } //[1] () -> void {} (); // { dg-error: "expected identifier" } return 0; }
google
chromium
lambda-direct-init
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C
166
utf_8
42c269128ec251cc935bf084af3fbf0b
// Test that capture by copy uses direct-initialization. // { dg-options "-std=c++0x" } struct A { A(); explicit A(const A&); }; int main() { A a; [a]{}; }
google
chromium
lambda-use
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use.C
233
utf_8
84b9dbf948578dc586cf8cc0bdddc1f6
// { dg-options -std=c++0x } int main(int argc, char** argv) { int i; int &ir = i; const int ci = 0; const int &cir = ci; [] { sizeof (argc); sizeof (i); sizeof (ir); sizeof (ci); sizeof (cir); }; [] { int ia[ci]; }; }
google
chromium
lambda-debug
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-debug.C
226
utf_8
eaeb125e48b43a15357e1b53d7013cd8
// PR c++/43502 // { dg-options "-std=c++0x -fcompare-debug" } void g (int n) { int bef ([]{return 0;}()); } struct S { void f (int = []{return 0;}(), int = [] { return 0;}()); }; int main () { S ().f (); return 0; }
google
chromium
lambda-type
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-type.C
2,020
utf_8
caaefd4848f06121f583c4ee5fbfe0f5
// Every id-expression that is a use (_basic.def.odr_ 3.2) of an entity // captured by copy is transformed into an access to the corresponding // unnamed data member of the closure type. //... // Every occurrence of decltype((x)) where x is a possibly parenthesized // id-expression that names an entity of automatic sto...
google
chromium
lambda-errloc2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-errloc2.C
262
utf_8
4f12cdfe781a553313a09b3bec1f9e14
// PR c++/42399 // { dg-options "-std=c++0x" } struct A { A(); A(const A&) = delete; // { dg-error "declared" } }; template <class T> void f() { T t; [t] { return 0; }; // { dg-error "use" } } int main() { f<A>(); // { dg-message "required" } }
google
chromium
lambda-use2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C
156
utf_8
9f738a4069b422b8b3a96212a9f28ba7
// PR c++/50224 // { dg-options "-std=c++0x -Wunused-parameter" } struct T; void m(T& t) // ERROR here { [&]{ t; // ``t`` is referenced here }; }
google
chromium
lambda-__func__
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__.C
143
utf_8
90b350c0b9cc2b8f8033e108b56da294
// PR c++/44160 // { dg-options -std=c++0x } // { dg-do link } int main() { const char *p = []() { return __func__; }(); return p == 0; }
google
chromium
lambda-template
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
915
utf_8
dcb0e745e2d6786f393d805b89dc0b34
// { dg-options -std=c++0x } // { dg-do run } extern "C" void abort(); template <class T> auto apply (T t) -> decltype (t()) { return t(); } template <class T> T f(T t) { T t2 = t; if (t != [=]()->T { return t; }()) abort (); if (t != [=] { return t; }()) abort (); if (t != [=] { return t2; }()) ...
google
chromium
lambda-conv3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv3.C
310
utf_8
74374338d46ee8c68c3cf296fa0df579
// Conversion to a function pointer uses a generic thunk, which doesn't // work properly for variadics. Make sure that we can still use the lambda // normally. // { dg-options -std=c++0x } void f() { auto l = [](...){}; void (*p1)(...) = l; // { dg-bogus "sorry" "" { xfail *-*-* } } l(); // OK }
google
chromium
lambda-nested2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
844
utf_8
95d30d62bae767ff38ef46c4c6c58836
// Testcase from N2998 // { dg-options -std=c++0x } void f1(int i) { int const N = 20; auto m1 = [=]{ int const M = 30; auto m2 = [i]{ int x[N][M]; // OK: N and M are not "used" x[0][0] = i; // OK: i is explicitly captured by m2 // and implicitly captured by m1 }...
google
chromium
lambda-ref2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ref2.C
155
utf_8
acbae52bdbdaf07e52af0298a84decea
// PR c++/49598 // { dg-options -std=c++0x } // { dg-do run } int main() { int i = 10; int& ir = i; if ([=]{ return ir; }() != 10) return 1; }
google
chromium
lambda-non-const
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-non-const.C
281
utf_8
96adf75a6123dcdced3a43ce92c560f9
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> template<typename F> void call(F f) { f(); } int main() { call([] () -> void {}); call([] () mutable -> void {}); int i = -1; call([i] () mutable -> void { i = 0; }); assert(i == -1); return 0; }
google
chromium
lambda-ice3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
295
utf_8
aeedb86ecc165de825ed34f0347ad287
// PR c++/47795 // { dg-options "-std=c++0x" } class Klass { unsigned int local; public: bool dostuff(); }; bool Klass::dostuff() { auto f = []() -> bool { if (local & 1) { return true; } // { dg-error "not captured" } return false; }; } int main() { Klass c; return 0; }
google
chromium
lambda-deduce
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce.C
433
utf_8
3a8ac1a6dc90653e67b79c435fc14b00
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> int main() { [] {}; [] {} (); [] () {}; [] () {} (); [] () { return "lambda"; }; int i = 1, j = 2; [&i, j] () { i = j; } (); assert(i == 2); assert(j == 2); i = [] () { return 3; } (); assert(i == 3); int k = [&] () { return ...
google
chromium
lambda-ice1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C
170
utf_8
d571c1f713fa3db34b2ad3b7c961930a
// PR c++/43790 // { dg-options "-std=c++0x" } struct A { int f(); }; int main() { A a; auto l = [] () { return a.f(); }; // { dg-error "not captured|return" } }
google
chromium
lambda-nested
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested.C
742
utf_8
34d4bd2e8072372b2517f7e9d3446084
// { dg-do run } // { dg-options "-std=c++0x" } #include <cassert> struct A { int i; A(): i(42) { } int f() { return [this]{ return [=]{ return i; }(); }(); } }; int main() { int i = 1; [] (int& i) -> void { [&] () -> void { i = 2; } (); } (i); assert(i == 2); [&] () ...
google
chromium
lambda-lookup-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-lookup-neg.C
135
utf_8
9914379697936570b4ff15460f76ac01
// Test that we don't crash on a failed lookup. // { dg-options -std=c++0x } int main() { [i]{}; // { dg-error "not declared" } }
google
chromium
lambda-deduce-ext-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-deduce-ext-neg.C
451
utf_8
edb40a05e5aff847b5abecf88adadd03
// Testcase for DR 975. // { dg-options -std=c++0x } bool b; struct A { int fn1(); const int& fn2(); }; struct B { int fn1(); long fn2(); }; template <class T> int f (T t) { return [](T t){ if (b) return t.fn1(); else return t.fn2(); // { dg-error "inconsistent types" } }(t); } int main() {...
google
chromium
lambda-init
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C
156
utf_8
8d2b28fcf373d04388bf30186708d379
// Test for the explicit initializer extension // { dg-options "-std=c++0x" } int main() { int j = [i = 2]{sizeof(i); return i;}(); return (j != 2); }
google
chromium
lambda-warn3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C
163
utf_8
c800d45765db6698010f4fa30789fda6
// PR c++/49482 // { dg-options "-std=c++0x -Wunused-but-set-parameter" } template<class T> void f() { []( bool b ){ return b; }; } int main() { f<int>(); }
google
chromium
lambda-eh2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C
304
utf_8
b88a795aaa2898fb80b0ec0b82214e74
// PR c++/47263 // PR c++/49260 // { dg-options "-std=c++0x -fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm" } // { dg-do run } #include <exception> int main( void ) { std::set_unexpected( []{ throw 0; } ); try { []() throw( int ) { throw nullptr; }(); } catch( int ) { } }
google
chromium
lambda-conv4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv4.C
168
utf_8
58edd027a4be4906904e2331d027b5c8
// PR c++/43641 // { dg-options "-std=c++0x" } struct B { int i; }; void func() { [](const B& b) -> const int& { return b.i; }; [](const B& b) { return b; }; }
google
chromium
lambda-in-class-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-in-class-neg.C
734
utf_8
51d8d60d3e651fc7642bb895c57a224f
// { dg-options "-std=c++0x" } #include <cassert> class C { private: int m_i; public: C() : m_i(-1) { [] { this; } (); // { dg-error "not captured" } [this] () -> void { m_i = 0; } (); assert(m_i == 0); [this] () -> void { this->m_i = 1; } (); assert(m_i == 1); [&] ()...
google
chromium
lambda-variadic1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic1.C
156
utf_8
8bb8bb40e31cf56e707b5342b10e7c59
// PR c++/49672 // { dg-options -std=c++0x } template<typename ... Args> static void foo() { [](Args..., int x) { x; }; } int main() { foo(); }
google
chromium
lambda-mangle2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle2.C
214
utf_8
e79c4415eb67d592185440eb9b8fda50
// PR c++/49276 // { dg-do compile } // { dg-options "-std=c++0x" } template <int N> struct F { template <typename U> F (U); }; struct S { void foo (F <0> x = [] {}) {} }; int main () { S s; s.foo (); }
google
chromium
lambda-array
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array.C
332
utf_8
4a88207602c959a71cb68833ac3176a7
// Test that array capture by copy works. // { dg-options -std=c++0x } // { dg-do run } struct A { int i; A(int i): i(i) {} A(const A& a): i(a.i+1) {} }; int main() { A ar[4][3] = { { 10, 20, 30 }, { 40, 50, 60 }, { 70, 80, 90 }, { 100, 110, 120 } }; int i = [ar] { return ar[1][1]; }().i; return ...
google
chromium
lambda-for
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C
215
utf_8
02f20fb8b429131ddea86b03510488e5
// PR c++/50114 // { dg-options "-std=c++0x -w" } int open() { int *x2feed_i = 0; auto insert_feed = [&](unsigned char venue, int* newfeed) { for(int x2feed_i = 1; 0; ) ; x2feed_i = newfeed; }; }
google
chromium
lambda-copy-default-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-copy-default-neg.C
255
utf_8
eb6ad09e63a403c2d1214b2f57e10b0f
// { dg-options "-std=c++0x" } int main() { int i; const char* s; [=] () -> void { i; s; i; s; } (); [] () -> void { i; } (); // { dg-error "" "`i' is not captured" } [1] () -> void {} (); // { dg-error "expected identifier" } return 0; }
google
chromium
lambda-const-neg
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const-neg.C
371
utf_8
0a68dd13e614fbf045182246e71a882b
// { dg-options "-std=c++0x" } #include <cassert> template<typename F> void call(const F& f) { f(); } int main() { call([] () -> void {}); call([] () mutable -> void {}); int i = -1; call([&i] () -> void { i = 0; }); assert(i == 0); call([i] () -> void { i = 0; }); // { dg-error "" "assignment to non-re...
google
chromium
gcov-3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-3.C
348
utf_8
0e241a16c3faf2f0c387bd2978d2b824
/* Check that gcov doesn't abort when a static object is defined within a header file. */ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run { target native } } */ #include "gcov-3.h" extern int foo(); int main () { return foo(); /* count(1) */ } /* { dg-final...
google
chromium
gcov-1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-1.C
6,705
utf_8
ed8a6c94f1bc2e70a324d73a77190040
/* Check that execution counts and branch probabilities for various C constructs are reported correctly by gcov. */ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run { target native } } */ extern "C" void abort (void); int do_something (int i) { return i; } /* Check static inline functions. ...
google
chromium
gcov-6
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-6.C
309
utf_8
0db2a2956de58970834889c74f43082d
// PR gcov-profile/34609 // { dg-do compile } // { dg-options "-O -ftest-coverage" } struct A { int i; int &get () { return i; } }; inline A foo () { A a; a.get (); return a; } inline A bar () { return foo (); } void baz () { A a; a = bar (); } // { dg-final { cleanup-coverage-files } }
google
chromium
gcov-4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-4.C
785
utf_8
a7c093e32d8e0cc08e02c3253748979c
/* Check that execution counts and branch probabilities for various C constructs are reported correctly by gcov. */ #include <stdio.h> /* { dg-options "-fprofile-arcs -ftest-coverage -fno-exceptions" } */ /* { dg-do run { target native } } */ class foo { public: foo() { printf("foo()\n"); }; ~foo() { printf("...
google
chromium
gcov-2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-2.C
465
utf_8
8a878271fda0c051fbf0d23ab78d7afe
/* Verify line coverage counts for simple member functions. */ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run { target native } } */ class C { public: C() { i = 0; /* count(1) */ } ~C() {} void seti (int j) { i = j; /* count(1) */ } private: int i; }; void foo() { ...
google
chromium
gcov-7
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-7.C
433
utf_8
5040b21deb49dcde39b08d954a7ef6a8
/* Check that Exception handler specification is not mapped to the curly braces below the function declaration. */ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run { target native } } */ struct foo { foo () throw (int) { /* count (-) */ throw (1); } }; int main () { try...
google
chromium
gcov-5
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/gcov/gcov-5.C
928
utf_8
8ade32db1de614a89b3775d4d1d03415
/* Check that execution counts for template functions are reported correctly by gcov. */ #include <stdio.h> #include <stdlib.h> /* { dg-options "-fprofile-arcs -ftest-coverage -fno-inline" } */ /* { dg-do run { target native } } */ class A { int count; public: A(int c) { count = c; } void func(void) { prin...
google
chromium
cond6
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/cond6.C
322
utf_8
7a1a3b98a22e73124c10abe63b9e58eb
// PR c++/11283 // Converting "a" to the type of "i" produces "int" rather than "const // int", which was causing build_conditional_expr to abort. But we don't // care about cv-quals on non-class rvalues. struct A { operator int (); }; extern A a; extern const int i; extern bool b; int f () { return b ? a : i; ...
google
chromium
bitfield10
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield10.C
331
utf_8
38f6bad87ae88f3b5e8814eb2a0cb3cd
// PR c++/38007 // We need to use the conversion function to the declared type of a bitfield, // not the lowered bitfield type. // { dg-do link } struct A { operator unsigned int() { return 42; } operator unsigned char(); }; struct B { unsigned int b : 8; }; int main () { A u; unsigned int v = u; B w; ...
google
chromium
ptrmem2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem2.C
1,433
utf_8
c26b0c2e104921cf5519ee58bb9cc752
// { dg-do compile } // Assorted pointer to data member static cast tests. struct A { int x; }; struct B : A { int x; }; struct P : A { int x; }; struct V { int x; }; struct D : B, virtual V, private P { int x; }; // Valid static casts. int B::*p1 = static_cast<int B::*>(&D::x); int D::*p2 = static_cast<int D::*>(&B::x...
google
chromium
bitfield9
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield9.C
205
utf_8
e957e40d1b691f5227994efd43cc2472
// PR c++/35909 // { dg-do compile } struct MidiCommand { unsigned data1 : 8; }; void g(const unsigned char &); void h(const unsigned int &); void f(MidiCommand mc) { g(mc.data1); h(mc.data1); }
google
chromium
const2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/const2.C
141
utf_8
cd42b5b37923de04f2f1d946dfbd433c
struct B {}; struct D : public B {}; typedef int B::*bm; typedef int D::*dm; bm bp; void f() { const_cast<dm>(bp); // { dg-error "" } }
google
chromium
self1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/self1.C
131
utf_8
9f33237b06a0754b17722be2e4ac5adf
// PR c++/31419 struct B { template<typename T> operator T const& () const { return 42; } }; B f() { return B(); }
google
chromium
bitfield11
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield11.C
203
utf_8
60e79aef553bffd7cb5b1c983d5960a8
// Make sure that digest_init converts to the declared type of the // bitfield, not just the lowered type. enum E { EA, EB }; struct A { E e: 8; }; A a = { 0 }; // { dg-error "invalid conversion" }
google
chromium
dynamic1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/dynamic1.C
198
utf_8
eb10fe6db1351b178c1c1068e9806fed
// PR c++/10385 // { dg-do compile } struct A { void foo(); }; A& bar(); void baz() { dynamic_cast<A&>( bar().foo ); // { dg-error "cannot dynamic_cast" } }
google
chromium
op3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/op3.C
96
utf_8
abda548f6cf197b5d004afe0b4fa5557
// PR c++/22256 struct node { int* operator int*(); }; // { dg-error "return type specified" }
google
chromium
ptrmem3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem3.C
1,145
utf_8
1896de082df820f0dcb7e67fe47949ca
// { dg-do compile } // Assorted pointer to member function static cast tests. struct A { int f (); }; struct B : A { int f (); }; struct P : A { int f (); }; struct V { int f (); }; struct D : B, virtual V, private P { int f (); }; // Valid static casts. int (B::*p1)() = static_cast<int (B::*)()>(&D::f); int (D::*p2)(...
google
chromium
ptrmem5
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem5.C
1,115
utf_8
626164a31d44e2553076ebfa89823d12
// { dg-do compile } // Assorted pointer to member function c-style cast tests. struct X {}; struct A { int f (); }; struct B : A { int f (); }; struct P : A { int f (); }; struct V { int f (); }; struct D : B, virtual V, private P { int f (); }; // Accessible, non-virtual, non-ambiguous base clas. int (B::*p1)() = (in...
google
chromium
ptrmem7
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem7.C
709
utf_8
0fe129d5222cc52f6d9f59e2a4ccd0de
// { dg-do compile } // Assorted pointer to member function implicit cast tests. struct A { int f (); }; struct B : A { int f (); }; struct P : A { int f (); }; struct V { int f (); }; struct D : B, virtual V, private P { int f (); }; // Valid. int (D::*p1)() = &B::f; // Derived class. int (B::*p2)() = &D::f; // { dg-e...
google
chromium
op4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/op4.C
341
utf_8
a15929071671cfff0d8ceeaee75f5add
/* PR c++/26698 */ /* { dg-do compile } */ struct X { int x; X (int i = 0) : x (i) {} operator X& (void) const { return *(new X); } }; void add_one (X & ref) { /* { dg-error "in passing argument" } */ ++ ref.x; } void foo() { X const a (2); add_one(a); /* { dg-error "invalid initialization of refer...
google
chromium
cond4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/cond4.C
458
utf_8
77ace45cd5e111b4a9ba8fb6c6867e95
// Origin: PR c++/45383 // { dg-do run } struct null { null() {} template<class T> operator T*() const { return 0; } template<class C, class T> operator T C::*() const { return 0; } private: null(const null&); null& operator=(const null&); void operator&() const; }; st...
google
chromium
op1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/op1.C
234
utf_8
2a192b5427feda4a29dae1a4f0493eaf
class C { template<typename U> operator U(); // { dg-message "note" } }; int fn (C c) { // { dg-message "candidate" "candidate note" { target *-*-* } 9 } }
google
chromium
dr195-1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/dr195-1.C
885
utf_8
424f02c389b9f1fb60fa25d7cda32717
// { dg-options "" } // DR 195 will allow conversions between function and object pointers // under some circumstances. It is in drafting, so we don't implement // it (yet). // this checks we are silent when not being pedantic. typedef void (*PF)(void); typedef void *PV; typedef int *PO; void foo () { PF pf; PV pv;...
google
chromium
const3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/const3.C
79
utf_8
8dae0b4264c4a22a22f3c8abe5fbdf3b
// PR c++/18177 void foo() { X; // { dg-error "" } const_cast<int&>(X); }
google
chromium
access1
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/access1.C
294
utf_8
f0aed431ce3357281e21fdd3e10a7644
// PR c++/38579 struct P { protected: P() {} P(const P&) {} }; struct B : protected P { B() {} }; struct C : public P { // C can access P's copy ctor, but can't convert b to const P&. C(const B& b) : P(b) {} // { dg-error "inaccessible base" } }; void foo() { B b; C c(b); }
google
chromium
bitfield5
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield5.C
220
utf_8
5b834a111d6345f96efbf3c3d5bdaa5e
// PR c++/27506 enum EBorderStyle { BNATIVE, BHIDDEN }; struct BorderValue { enum EBorderStyle style:8; }; enum EBorderStyle f(const struct BorderValue *border) { return border ? border->style : BNATIVE; }
google
chromium
bitfield8
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield8.C
487
utf_8
df929a9deae2fb3db69b7347b27518fa
// PR c++/35056 // { dg-do compile } // { dg-options "-O2" } enum EBorderStyle { bla = 1 }; inline bool compare_ref(const unsigned int &t, const EBorderStyle &u) { return t == u; } inline bool compare_val(const unsigned int t, const EBorderStyle u) { return t == u; } struct S { unsigned m_style : 4; }; void call_ref...
google
chromium
simd2
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/simd2.C
330
utf_8
8e41381be792deb70891ea9cc1764f4a
/* { dg-do compile } */ /* Test generic operations on vectors. */ int __attribute__((vector_size(16))) a, b, c; int __attribute__((vector_size(8))) d; void foo() { a = b ^ c; a = b + c; a = b - c; a = b * c; a = b / c; a = -b; a = d + b; /* { dg-error "invalid operands to binary +...
google
chromium
ptrmem4
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/ptrmem4.C
1,260
utf_8
17ad39eaf20adaa0ed0d05ef893ab3e3
// { dg-do compile } // Assorted pointer to data member c-style cast tests. struct X {}; struct A { int x; }; struct B : A { int x; }; struct P : A { int x; }; struct V { int x; }; struct D : B, virtual V, private P { int x; }; // Accessible, non-virtual, non-ambiguous base clas. int B::*p1 = (int B::*)&D::x; int D::*p...
google
chromium
op5
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/op5.C
292
utf_8
e931274865053d8a40492868844d5c08
// Origin: PR c++/36407 // { dg-do compile } struct A { A (const A&); }; struct B { operator A&(); }; void foo (const B& b) { const A a = b; // { dg-error "conversion from 'const B' to non-scalar type 'const A' requested" } }
google
chromium
bitfield3
.C
native_client/pnacl-gcc/gcc/testsuite/g++.dg/conversion/bitfield3.C
235
utf_8
be810813d630f0dd9802ec2a447ebbae
// PR c++/16376 // { dg-do run } int main(void){ struct bits { unsigned int ui3 : 3; } bits; int i = -1; /* is a very large positive number as unsigned */ bits.ui3 = 1u; if( bits.ui3 < i ) return 1; return 0; }