2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2008-01-12 16:14:25 +08:00
|
|
|
|
2008-01-13 02:39:25 +08:00
|
|
|
void abcdefghi12(void) {
|
2008-01-12 16:14:25 +08:00
|
|
|
const char (*ss)[12] = &__func__;
|
2008-01-13 02:39:25 +08:00
|
|
|
static int arr[sizeof(__func__)==12 ? 1 : -1];
|
2008-01-12 16:14:25 +08:00
|
|
|
}
|
|
|
|
|
2008-12-12 13:05:20 +08:00
|
|
|
char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
|
2021-10-15 05:52:47 +08:00
|
|
|
expected-warning {{initializing 'char *' with an expression of type 'const char[1]' discards qualifiers}}
|
2008-01-13 02:39:25 +08:00
|
|
|
|
|
|
|
void a() {
|
|
|
|
__func__[0] = 'a'; // expected-error {{variable is not assignable}}
|
|
|
|
}
|
2008-12-12 13:05:20 +08:00
|
|
|
|
2021-11-24 22:52:01 +08:00
|
|
|
// rdar://6097892 - GCC permits this.
|
2008-12-12 13:05:20 +08:00
|
|
|
const char *b = __func__; // expected-warning {{predefined identifier is only valid}}
|
|
|
|
const char *c = __FUNCTION__; // expected-warning {{predefined identifier is only valid}}
|
|
|
|
const char *d = __PRETTY_FUNCTION__; // expected-warning {{predefined identifier is only valid}}
|
|
|
|
|