summaryrefslogtreecommitdiffstats
path: root/clang/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
commitf45c5ecb3bbd4183b0675689f4cdf6884e7e269f (patch)
treeec9de74f858c31e543a61c708de5f8c97f55c0ac /clang/test/Sema/predef.c
parent81ed6805db67b5b435650334df4bf97ca2cc55f7 (diff)
downloadbcm5719-llvm-f45c5ecb3bbd4183b0675689f4cdf6884e7e269f.tar.gz
bcm5719-llvm-f45c5ecb3bbd4183b0675689f4cdf6884e7e269f.zip
fix rdar://6097892 - gcc incompat: clang rejects __func__, __FUNCTION__, and __PRETTY_FUNCTION__ outside func
Yeah, this is "useful". llvm-svn: 60921
Diffstat (limited to 'clang/test/Sema/predef.c')
-rw-r--r--clang/test/Sema/predef.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/test/Sema/predef.c b/clang/test/Sema/predef.c
index bd5e1a98b24..097950ccc63 100644
--- a/clang/test/Sema/predef.c
+++ b/clang/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}}
+
OpenPOWER on IntegriCloud