Open kyleheadley opened 2 years ago
A concrete failing test case:
#include<string.h>
void test(void) {
char *d = __func__;
strlen(d);
}
converts to
#include<string.h>
void test(void) {
_Nt_array_ptr<char> d = __func__;
strlen(d);
}
but this fails to compile with
error: initializing '_Nt_array_ptr<char>' with an expression of incompatible type 'const char [5]'
_Nt_array_ptr<char> d = __func__;
It looks like a cast would come to our rescue again, just as in #725:
void test(void) {
// Error
_Nt_array_ptr<char> p = __func__;
// No error
_Nt_array_ptr<char> p2 = (_Nt_array_ptr<char>) __func__;
}
We can go ahead and do that in 3C. Ideally, we'd also file a bug against the compiler.
The predefined identifier
__func__
represents the name of the enclosing function as aconst char []
. This is used in macros in 3C's icecast benchmark. It can be assigned to an_Nt_array_ptr<const char>
, but only in a checked scope. 3C doesn't insert that checked scope without-addcr
and block safety, but still rewrites to the nt array pointer.We need a better way to handle these situations.