summaryrefslogtreecommitdiff
path: root/test/Sema/predef.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-12 05:05:20 +0000
committerChris Lattner <sabre@nondot.org>2008-12-12 05:05:20 +0000
commitb0da923653601191c4f60bdc284feae376d28cda (patch)
treecd97e8df7740394b529b21b517bf379263882184 /test/Sema/predef.c
parentcd08707a960842223e4af9ab82c729ba179290c0 (diff)
downloadclang-b0da923653601191c4f60bdc284feae376d28cda.tar.gz
fix rdar://6097892 - gcc incompat: clang rejects __func__, __FUNCTION__, and __PRETTY_FUNCTION__ outside func
Yeah, this is "useful". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/predef.c')
-rw-r--r--test/Sema/predef.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/Sema/predef.c b/test/Sema/predef.c
index bd5e1a98b2..097950ccc6 100644
--- a/test/Sema/predef.c
+++ b/test/Sema/predef.c
@@ -5,8 +5,15 @@ void abcdefghi12(void) {
static int arr[sizeof(__func__)==12 ? 1 : -1];
}
-char *X = __func__; // expected-error {{predefined identifier is only valid}}
+char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
+ expected-warning {{initializing 'char const [1]' discards qualifiers, expected 'char *'}}
void a() {
__func__[0] = 'a'; // expected-error {{variable is not assignable}}
}
+
+// rdar://6097892 - GCC permits this insanity.
+const char *b = __func__; // expected-warning {{predefined identifier is only valid}}
+const char *c = __FUNCTION__; // expected-warning {{predefined identifier is only valid}}
+const char *d = __PRETTY_FUNCTION__; // expected-warning {{predefined identifier is only valid}}
+