#include <stdexcept>
using namespace std;
struct Foo
{
unsigned small_value;
};
class SmallValue
{
unsigned value;
public:
SmallValue(unsigned x=0)
{
if(x>100) throw invalid_argument("");
value = x;
}
};
struct Bar
{
SmallValue small_value;
};
template<typename T>
void same_syntax()
{
T x;
x.small_value = 11;
}
int main()
{
same_syntax<Foo>();
same_syntax<Bar>();
}
I2luY2x1ZGUgPHN0ZGV4Y2VwdD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBGb28KewogICAgdW5zaWduZWQgc21hbGxfdmFsdWU7Cn07CgpjbGFzcyBTbWFsbFZhbHVlCnsKICAgIHVuc2lnbmVkIHZhbHVlOwpwdWJsaWM6CiAgICBTbWFsbFZhbHVlKHVuc2lnbmVkIHg9MCkKICAgIHsKICAgICAgICBpZih4PjEwMCkgdGhyb3cgaW52YWxpZF9hcmd1bWVudCgiIik7CiAgICAgICAgdmFsdWUgPSB4OwogICAgfQp9OwpzdHJ1Y3QgQmFyCnsKICAgIFNtYWxsVmFsdWUgc21hbGxfdmFsdWU7Cn07Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBUPgp2b2lkIHNhbWVfc3ludGF4KCkKewogICAgVCB4OwogICAgeC5zbWFsbF92YWx1ZSA9IDExOwp9CgppbnQgbWFpbigpCnsKICAgIHNhbWVfc3ludGF4PEZvbz4oKTsKICAgIHNhbWVfc3ludGF4PEJhcj4oKTsKfQ==