predef.c revision b0da923653601191c4f60bdc284feae376d28cda
1// RUN: clang -fsyntax-only -verify %s
2
3void abcdefghi12(void) {
4 const char (*ss)[12] = &__func__;
5 static int arr[sizeof(__func__)==12 ? 1 : -1];
6}
7
8char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
9                       expected-warning {{initializing 'char const [1]' discards qualifiers, expected 'char *'}}
10
11void a() {
12  __func__[0] = 'a';  // expected-error {{variable is not assignable}}
13}
14
15// rdar://6097892 - GCC permits this insanity.
16const char *b = __func__;  // expected-warning {{predefined identifier is only valid}}
17const char *c = __FUNCTION__; // expected-warning {{predefined identifier is only valid}}
18const char *d = __PRETTY_FUNCTION__; // expected-warning {{predefined identifier is only valid}}
19
20