namespace X
{
template<typename T, unsigned int SIZE>
bool IsArray (T (&a)[SIZE]) { return true; }
template<typename T>
bool IsArray (const T *&p) { return false; }
}
namespace Y
{
typedef char (&yes)[2];
template<typename T, unsigned int SIZE>
yes IsArray (T (&a)[SIZE]);
template<typename T>
char IsArray (const T *&p);
}
int main ()
{
char s1[] = "hello";
const char *s2 = "hello";
#if 1
using namespace X;
if(true == IsArray(s2))
throw 0;
if(false == IsArray("12345"))
throw 0;
if(false == IsArray(s1))
throw 0;
#else
using namespace Y;
if(sizeof(IsArray(s2)) == sizeof(yes))
throw 0;
if(sizeof(IsArray(s1)) != sizeof(yes))
throw 0;
#endif
}
bmFtZXNwYWNlIFgKewogIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHVuc2lnbmVkIGludCBTSVpFPgogIGJvb2wgSXNBcnJheSAoVCAoJmEpW1NJWkVdKSB7IHJldHVybiB0cnVlOyB9CiAgCiAgdGVtcGxhdGU8dHlwZW5hbWUgVD4KICBib29sIElzQXJyYXkgKGNvbnN0IFQgKiZwKSB7IHJldHVybiBmYWxzZTsgfQp9CiAgCm5hbWVzcGFjZSBZCnsKICB0eXBlZGVmIGNoYXIgKCZ5ZXMpWzJdOwogIAogIHRlbXBsYXRlPHR5cGVuYW1lIFQsIHVuc2lnbmVkIGludCBTSVpFPgogIHllcyBJc0FycmF5IChUICgmYSlbU0laRV0pOwogIAogIHRlbXBsYXRlPHR5cGVuYW1lIFQ+CiAgY2hhciBJc0FycmF5IChjb25zdCBUIComcCk7Cn0KCgppbnQgbWFpbiAoKQp7CiAgY2hhciBzMVtdICA9ICJoZWxsbyI7CiAgY29uc3QgY2hhciAqczIgICA9ICJoZWxsbyI7CiNpZiAxCiAgdXNpbmcgbmFtZXNwYWNlIFg7CiAgaWYodHJ1ZSA9PSBJc0FycmF5KHMyKSkKICAgIHRocm93IDA7CiAgaWYoZmFsc2UgPT0gSXNBcnJheSgiMTIzNDUiKSkKICAgIHRocm93IDA7CiAgaWYoZmFsc2UgPT0gSXNBcnJheShzMSkpCiAgICB0aHJvdyAwOwojZWxzZQogIHVzaW5nIG5hbWVzcGFjZSBZOwogIGlmKHNpemVvZihJc0FycmF5KHMyKSkgPT0gc2l6ZW9mKHllcykpCiAgICB0aHJvdyAwOwogIGlmKHNpemVvZihJc0FycmF5KHMxKSkgIT0gc2l6ZW9mKHllcykpCiAgICB0aHJvdyAwOwojZW5kaWYKfQ==