aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/typeof.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-07-31 12:34:36 +0000
committerSteve Naroff <snaroff@apple.com>2007-07-31 12:34:36 +0000
commitd1861fd633d5096a00777c918eb8575ea7162fe7 (patch)
treecd71c78f1c513b18ab427f6036aa2debdcb7d93a /test/Parser/typeof.c
parent8a2bc625e86983e250ed31040695a870a767196b (diff)
Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files. Still some FIXME's, however the basic support is in place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/typeof.c')
-rw-r--r--test/Parser/typeof.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Parser/typeof.c b/test/Parser/typeof.c
new file mode 100644
index 0000000000..4829713b27
--- /dev/null
+++ b/test/Parser/typeof.c
@@ -0,0 +1,18 @@
+// RUN: clang -parse-ast-check %s -pedantic
+
+typedef int TInt;
+
+static void test() {
+ int *pi;
+
+ typeof(TInt) anInt; // expected-warning{{extension used}}
+ typeof(const int) aci; // expected-warning{{extension used}}
+ const typeof (*pi) aConstInt; // expected-warning{{extension used}}
+ int xx;
+ short typeof (*pi) aShortInt; // expected-error{{'short typeof' is invalid}}
+ int *i;
+ i = aci; // expected-warning{{incompatible types assigning 'typeof(int const)' to 'int *'}}
+ i = anInt; // expected-warning{{incompatible types assigning 'typeof(TInt)' to 'int *'}}
+ i = aConstInt; // expected-warning{{incompatible types assigning 'typeof(<expr>) const' to 'int *'}}
+ i = xx; // expected-warning{{incompatible types assigning 'int' to 'int *'}}
+}