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