blob: 7b3fe5038f9674ea8c15fc57bce25867f25b14cb [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Chris Lattnerfa28b302008-01-12 08:14:25 +00002
Chris Lattner1423ea42008-01-12 18:39:25 +00003void abcdefghi12(void) {
Chris Lattnerfa28b302008-01-12 08:14:25 +00004 const char (*ss)[12] = &__func__;
Chris Lattner1423ea42008-01-12 18:39:25 +00005 static int arr[sizeof(__func__)==12 ? 1 : -1];
Chris Lattnerfa28b302008-01-12 08:14:25 +00006}
7
Chris Lattnerb0da9232008-12-12 05:05:20 +00008char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
9 expected-warning {{initializing 'char const [1]' discards qualifiers, expected 'char *'}}
Chris Lattner1423ea42008-01-12 18:39:25 +000010
11void a() {
12 __func__[0] = 'a'; // expected-error {{variable is not assignable}}
13}
Chris Lattnerb0da9232008-12-12 05:05:20 +000014
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