blob: 95bcfb9d8d51026614985b1ed52ab392ddd70242 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -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}} \
Chris Lattner58f9e132010-09-05 00:04:01 +00009 expected-warning {{initializing 'char *' with an expression of type 'const char [1]' discards qualifiers}}
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