blob: 08a4a2bf83e9f3ca34918009f3518d5883c3270a [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Chris Lattnera81a0272008-01-12 08:14:25 +00002
Chris Lattner317e6ba2008-01-12 18:39:25 +00003void abcdefghi12(void) {
Chris Lattnera81a0272008-01-12 08:14:25 +00004 const char (*ss)[12] = &__func__;
Chris Lattner317e6ba2008-01-12 18:39:25 +00005 static int arr[sizeof(__func__)==12 ? 1 : -1];
Chris Lattnera81a0272008-01-12 08:14:25 +00006}
7
Chris Lattnerf45c5ec2008-12-12 05:05:20 +00008char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
Douglas Gregorb10646d2010-04-09 17:53:29 +00009 expected-warning {{initializing 'char *' with an expression of type 'char const [1]' discards qualifiers}}
Chris Lattner317e6ba2008-01-12 18:39:25 +000010
11void a() {
12 __func__[0] = 'a'; // expected-error {{variable is not assignable}}
13}
Chris Lattnerf45c5ec2008-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