ptr->method();// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
take(ptr);// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
std::function<void(R*)>([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
std::function<void(R*)>([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
// These tests would check c++14 deduced return types, if they were supported in
// our codebase. They are being kept here for convenience in the future if we do
// add support for c++14 deduced return types
#if 0
autod1(){
R*ptr;
SmartPtr<R>sp;
return([&](R*argptr){
R*localptr;
ptr->method();
argptr->method();
localptr->method();
});
}
autod2(){
R*ptr;
SmartPtr<R>sp;
return([&](SmartPtr<R>argsp){
SmartPtr<R>localsp;
sp->method();
argsp->method();
localsp->method();
});
}
autod3(){
R*ptr;
SmartPtr<R>sp;
return([&](R*argptr){
R*localptr;
take(ptr);
take(argptr);
take(localptr);
});
}
autod4(){
R*ptr;
SmartPtr<R>sp;
return([&](SmartPtr<R>argsp){
SmartPtr<R>localsp;
take(sp);
take(argsp);
take(localsp);
});
}
autod5(){
R*ptr;
SmartPtr<R>sp;
return([=](R*argptr){
R*localptr;
ptr->method();// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
argptr->method();
localptr->method();
});
}
autod6(){
R*ptr;
SmartPtr<R>sp;
return([=](SmartPtr<R>argsp){
SmartPtr<R>localsp;
sp->method();
argsp->method();
localsp->method();
});
}
autod8(){
R*ptr;
SmartPtr<R>sp;
return([=](R*argptr){
R*localptr;
take(ptr);// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
take(argptr);
take(localptr);
});
}
autod9(){
R*ptr;
SmartPtr<R>sp;
return([=](SmartPtr<R>argsp){
SmartPtr<R>localsp;
take(sp);
take(argsp);
take(localsp);
});
}
autod10(){
R*ptr;
SmartPtr<R>sp;
return([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
R*localptr;
ptr->method();
argptr->method();
localptr->method();
});
}
autod11(){
R*ptr;
SmartPtr<R>sp;
return([sp](SmartPtr<R>argsp){
SmartPtr<R>localsp;
sp->method();
argsp->method();
localsp->method();
});
}
autod12(){
R*ptr;
SmartPtr<R>sp;
return([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
ptr->method();// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
argptr->method();
localptr->method();
});
};
autoe6=[](){
R*ptr;
SmartPtr<R>sp;
return([=](SmartPtr<R>argsp){
SmartPtr<R>localsp;
sp->method();
argsp->method();
localsp->method();
});
};
autoe8=[](){
R*ptr;
SmartPtr<R>sp;
return([=](R*argptr){
R*localptr;
take(ptr);// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
take(argptr);
take(localptr);
});
};
autoe9=[](){
R*ptr;
SmartPtr<R>sp;
return([=](SmartPtr<R>argsp){
SmartPtr<R>localsp;
take(sp);
take(argsp);
take(localsp);
});
};
autoe10=[](){
R*ptr;
SmartPtr<R>sp;
return([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}
R*localptr;
ptr->method();
argptr->method();
localptr->method();
});
};
autoe11=[](){
R*ptr;
SmartPtr<R>sp;
return([sp](SmartPtr<R>argsp){
SmartPtr<R>localsp;
sp->method();
argsp->method();
localsp->method();
});
};
autoe12=[](){
R*ptr;
SmartPtr<R>sp;
return([ptr](R*argptr){// expected-error{{Refcounted variable 'ptr' of type 'R' cannot be captured by a lambda}} expected-note{{Please consider using a smart pointer}}