Here the code snippet:
#include <iostream>
#include <memory>
int func()
{
int i = 0;
i++;
return i;
}
int main() {
auto foo = [sp=std::make_shared<int>(1)](){ int num = *sp++; return num;}; //no 'operator++(int)' declared for postfix '++' [-fpermissive]
func(); //`i++` works well
}
Since it's legal to call int i=0;i++; and *sp returns the object of int, so I think *sp++ is valid too.