summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wcxx-compat-10.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/Wcxx-compat-10.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/Wcxx-compat-10.c')
-rw-r--r--gcc/testsuite/gcc.dg/Wcxx-compat-10.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-10.c b/gcc/testsuite/gcc.dg/Wcxx-compat-10.c
new file mode 100644
index 000000000..0f1d037bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wcxx-compat-10.c
@@ -0,0 +1,73 @@
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+
+struct s1 { int f; };
+typedef int s2;
+void
+f1 ()
+{
+ typedef int s1;
+ struct s2 { int f; };
+}
+
+struct s3 { int f; };
+typedef struct s3 s3;
+
+typedef struct s4 s4;
+struct s4 { int f; };
+
+struct s5 { int f; }; /* { dg-message "note: originally defined here" } */
+typedef int s5; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+typedef int s6; /* { dg-message "note: originally defined here" } */
+struct s6 { int f; }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+void
+f2 ()
+{
+ struct s7 { int f; }; /* { dg-message "note: originally defined here" } */
+ typedef int s7; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+ typedef int s8; /* { dg-message "note: originally defined here" } */
+ struct s8 { int f; }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+ struct s9 { int f; };
+ { typedef int s9; }
+
+ typedef int s10;
+ { struct s10 { int f; }; }
+}
+
+enum e1 { A };
+typedef int e2;
+void
+f3 ()
+{
+ typedef int e1;
+ enum e2 { B };
+}
+
+enum e3 { C };
+typedef enum e3 e3;
+
+enum e5 { E }; /* { dg-message "note: originally defined here" } */
+typedef int e5; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+typedef int e6; /* { dg-message "note: originally defined here" } */
+enum e6 { F }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+void
+f4 ()
+{
+ enum e7 { G }; /* { dg-message "note: originally defined here" } */
+ typedef int e7; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+ typedef int e8; /* { dg-message "note: originally defined here" } */
+ enum e8 { H }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+ enum e9 { I };
+ { typedef int e9; }
+
+ typedef int e10;
+ { enum e10 { J }; }
+}