diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-12 18:39:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-12 18:39:25 +0000 |
commit | 1423ea4146f0f71e027adbcd04c9e715711d8063 (patch) | |
tree | 2225c3d408b61d90cb3b90b3f6e2741ed168895e /test/Sema/predef.c | |
parent | fa28b30d5a1e93e5263be33e343532b900d2c643 (diff) | |
download | clang-1423ea4146f0f71e027adbcd04c9e715711d8063.tar.gz |
Tighten up handling of __func__ and friends: it should be an array
of const char, and it should error if it occurs outside a function.
Is it valid in an objc method? If so we should handle that too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/predef.c')
-rw-r--r-- | test/Sema/predef.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/Sema/predef.c b/test/Sema/predef.c index f3dae39c10..bd5e1a98b2 100644 --- a/test/Sema/predef.c +++ b/test/Sema/predef.c @@ -1,7 +1,12 @@ -// RUN: clang -fsyntax-only %s +// RUN: clang -fsyntax-only -verify %s -int abcdefghi12(void) { +void abcdefghi12(void) { const char (*ss)[12] = &__func__; - return sizeof(__func__); + static int arr[sizeof(__func__)==12 ? 1 : -1]; } +char *X = __func__; // expected-error {{predefined identifier is only valid}} + +void a() { + __func__[0] = 'a'; // expected-error {{variable is not assignable}} +} |