#include <cstdlib>
#include <cstdio>
struct foo {
const char *const _str;
template <size_t E>
constexpr foo (const char (&str)[E]) : _str(str) {}
template <size_t E>
constexpr foo (char (&str)[E]) = delete;
void print() const {
const char local_copy[6] = {
_str[0], _str[1], _str[2], _str[3], _str[4], 0
};
puts(local_copy);
}
};
constexpr foo ohyeah = "moo";
void _foo (const foo &f) {
f.print();
}
#define MK_STATIC 0
foo getfoo() {
#if MK_STATIC
static
#endif
const char cbar[] = "cblah";
return cbar;
}
int main ()
{
_foo(getfoo());
//foo ohnoez = cbar;
//char bar[] = "blah";
//foo ohyeah2 = bar;
}
I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjc3RkaW8+CgpzdHJ1Y3QgZm9vIHsKCWNvbnN0IGNoYXIgKmNvbnN0IF9zdHI7CgkKCXRlbXBsYXRlIDxzaXplX3QgRT4KCWNvbnN0ZXhwciBmb28gKGNvbnN0IGNoYXIgKCZzdHIpW0VdKSA6IF9zdHIoc3RyKSB7fQoJdGVtcGxhdGUgPHNpemVfdCBFPgoJY29uc3RleHByIGZvbyAoY2hhciAoJnN0cilbRV0pID0gZGVsZXRlOwoKCXZvaWQgcHJpbnQoKSBjb25zdCB7CgkJY29uc3QgY2hhciBsb2NhbF9jb3B5WzZdID0gewoJCQlfc3RyWzBdLCBfc3RyWzFdLCBfc3RyWzJdLCBfc3RyWzNdLCBfc3RyWzRdLCAwCgkJfTsKCQlwdXRzKGxvY2FsX2NvcHkpOwoJfQp9OwoKY29uc3RleHByIGZvbyBvaHllYWggPSAibW9vIjsKCnZvaWQgX2ZvbyAoY29uc3QgZm9vICZmKSB7CglmLnByaW50KCk7Cn0KCiNkZWZpbmUgTUtfU1RBVElDIDAKCmZvbyBnZXRmb28oKSB7CiNpZiBNS19TVEFUSUMKCXN0YXRpYwojZW5kaWYKCWNvbnN0IGNoYXIgY2JhcltdID0gImNibGFoIjsKCXJldHVybiBjYmFyOwp9CgppbnQgbWFpbiAoKQp7CglfZm9vKGdldGZvbygpKTsKCS8vZm9vIG9obm9leiA9IGNiYXI7CgkvL2NoYXIgYmFyW10gPSAiYmxhaCI7CgkvL2ZvbyBvaHllYWgyID0gYmFyOwp9Cg==