#include <iostream>
struct My
{
typedef int foo;
};
struct My2
{
};
template<typename T, typename I=typename T::foo> void Bar(const T&, I z = I())
{
std::cout << "My\n";
}
template<typename T> void Bar(T&)
{
std::cout << "...\n";
}
int main()
{
My my;
Bar(my); // OK
My2 my2;
Bar(my2); // Also OK
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IE15CnsKICAgdHlwZWRlZiBpbnQgZm9vOwp9OwoKc3RydWN0IE15Mgp7Cn07Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBULCB0eXBlbmFtZSBJPXR5cGVuYW1lIFQ6OmZvbz4gdm9pZCBCYXIoY29uc3QgVCYsIEkgeiA9IEkoKSkKewoJc3RkOjpjb3V0IDw8ICJNeVxuIjsKfQoKdGVtcGxhdGU8dHlwZW5hbWUgVD4gdm9pZCBCYXIoVCYpCnsKCXN0ZDo6Y291dCA8PCAiLi4uXG4iOwp9CgppbnQgbWFpbigpIAp7CiAgICBNeSBteTsKICAgIEJhcihteSk7IC8vIE9LCiAgICBNeTIgbXkyOwogICAgQmFyKG15Mik7IC8vIEFsc28gT0sKICAgIHJldHVybiAwOwp9