Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Chris Lattner | fa28b30 | 2008-01-12 08:14:25 +0000 | [diff] [blame] | 2 | |
Chris Lattner | 1423ea4 | 2008-01-12 18:39:25 +0000 | [diff] [blame] | 3 | void abcdefghi12(void) { |
Chris Lattner | fa28b30 | 2008-01-12 08:14:25 +0000 | [diff] [blame] | 4 | const char (*ss)[12] = &__func__; |
Chris Lattner | 1423ea4 | 2008-01-12 18:39:25 +0000 | [diff] [blame] | 5 | static int arr[sizeof(__func__)==12 ? 1 : -1]; |
Chris Lattner | fa28b30 | 2008-01-12 08:14:25 +0000 | [diff] [blame] | 6 | } |
| 7 | |
Chris Lattner | b0da923 | 2008-12-12 05:05:20 +0000 | [diff] [blame] | 8 | char *X = __func__; // expected-warning {{predefined identifier is only valid}} \ |
Chris Lattner | 58f9e13 | 2010-09-05 00:04:01 +0000 | [diff] [blame] | 9 | expected-warning {{initializing 'char *' with an expression of type 'const char [1]' discards qualifiers}} |
Chris Lattner | 1423ea4 | 2008-01-12 18:39:25 +0000 | [diff] [blame] | 10 | |
| 11 | void a() { |
| 12 | __func__[0] = 'a'; // expected-error {{variable is not assignable}} |
| 13 | } |
Chris Lattner | b0da923 | 2008-12-12 05:05:20 +0000 | [diff] [blame] | 14 | |
| 15 | // rdar://6097892 - GCC permits this insanity. |
| 16 | const char *b = __func__; // expected-warning {{predefined identifier is only valid}} |
| 17 | const char *c = __FUNCTION__; // expected-warning {{predefined identifier is only valid}} |
| 18 | const char *d = __PRETTY_FUNCTION__; // expected-warning {{predefined identifier is only valid}} |
| 19 | |