1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | class example { public: example(const char (&in_data)[6]); }; example foo() { return "ABCDE"; } example bar() { return example("ABCDE"); } |
Y2xhc3MgZXhhbXBsZQp7CnB1YmxpYzoKICAgIGV4YW1wbGUoY29uc3QgY2hhciAoJmluX2RhdGEpWzZdKTsKfTsKCmV4YW1wbGUgZm9vKCkKewogICAgcmV0dXJuICJBQkNERSI7Cn0KCmV4YW1wbGUgYmFyKCkKewogICAgcmV0dXJuIGV4YW1wbGUoIkFCQ0RFIik7Cn0=
prog.cpp: In function ‘example foo()’: prog.cpp:9: error: conversion from ‘const char*’ to non-scalar type ‘example’ requested
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


