* c-c++-common/array-init.c: Add dg-prune-output. * g++.dg/cpp0x/lambda/lambda-const-this.C: Add dg-warning. * g++.dg/cpp0x/lambda/lambda-in-class-neg.C: Likewise. * g++.dg/cpp0x/lambda/lambda-in-class.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nested.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nsdmi1.C: Likewise. * g++.dg/cpp0x/lambda/lambda-nsdmi4.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this17.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this18.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this2.C: Likewise. * g++.dg/cpp0x/lambda/lambda-this8.C: Likewise. * g++.dg/cpp1y/pr64382.C: Likewise. * g++.dg/cpp1y/pr77739.C: Likewise. * g++.dg/cpp1z/lambda-this1.C: Likewise. * g++.dg/cpp1z/lambda-this2.C: Likewise. * g++.dg/template/crash84.C: Adjust dg-error. From-SVN: r264169
38 lines
905 B
C
38 lines
905 B
C
// PR c++/56135
|
|
// { dg-do run { target c++11 } }
|
|
|
|
#include <functional>
|
|
|
|
struct test {
|
|
template<typename T>
|
|
std::function<void()> broken(int x) {
|
|
return [=] { +x; print<T>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
|
|
}
|
|
|
|
std::function<void()> works0() {
|
|
return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
|
|
}
|
|
|
|
template<typename T>
|
|
std::function<void()> works1() {
|
|
return [=] { print<int>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
|
|
}
|
|
|
|
template<typename T>
|
|
std::function<void()> works2() {
|
|
return [=] { this->print<T>(); }; // { dg-warning "implicit capture" "" { target c++2a } }
|
|
}
|
|
|
|
template<typename T>
|
|
void print() { if (this == 0) __builtin_abort (); }
|
|
};
|
|
|
|
int main(void) {
|
|
test().broken<int>(1)();
|
|
test().works0()();
|
|
test().works1<int>()();
|
|
test().works2<int>()();
|
|
|
|
return 0;
|
|
}
|