summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/typedef-redecl.cpp
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/SemaCXX/typedef-redecl.cpp
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'test/SemaCXX/typedef-redecl.cpp')
-rw-r--r--test/SemaCXX/typedef-redecl.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp
new file mode 100644
index 0000000..e38f474
--- /dev/null
+++ b/test/SemaCXX/typedef-redecl.cpp
@@ -0,0 +1,31 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+typedef int INT;
+typedef INT REALLY_INT; // expected-note {{previous definition is here}}
+typedef REALLY_INT REALLY_REALLY_INT;
+typedef REALLY_INT BOB;
+typedef float REALLY_INT; // expected-error{{typedef redefinition with different types ('float' vs 'INT' (aka 'int'))}}
+
+struct X {
+ typedef int result_type; // expected-note {{previous definition is here}}
+ typedef INT result_type; // expected-error {{redefinition of 'result_type'}}
+};
+
+struct Y; // expected-note{{previous definition is here}}
+typedef int Y; // expected-error{{typedef redefinition with different types ('int' vs 'struct Y')}}
+
+typedef int Y2; // expected-note{{previous definition is here}}
+struct Y2; // expected-error{{definition of type 'struct Y2' conflicts with typedef of the same name}}
+
+void f(); // expected-note{{previous definition is here}}
+typedef int f; // expected-error{{redefinition of 'f' as different kind of symbol}}
+
+typedef int f2; // expected-note{{previous definition is here}}
+void f2(); // expected-error{{redefinition of 'f2' as different kind of symbol}}
+
+typedef struct s s;
+typedef int I;
+typedef int I;
+typedef I I;
+
+struct s { };
+
OpenPOWER on IntegriCloud