summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/redecl-14.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-10 12:38:34 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-10 12:38:34 +0000
commitfea849d3ae75cee1c377ecb89c6b0876e1fb601b (patch)
treebf0363a9abcdf9390c78c1340cf7f4002e86ccaf /gcc/testsuite/gcc.dg/redecl-14.c
parentfece76558f0e9adf2e176ac75bea7e1f1605e707 (diff)
downloadgcc-fea849d3ae75cee1c377ecb89c6b0876e1fb601b.tar.gz
PR c/21342
* c-decl.c (pushdecl): When there is a declaration in the current scope and the declarations are external linkage, check for compatibility with the type in the external scope and update the type in the external scope with the composite type information. Do not form a composite type of the new type and the visible type if they are incompatible. testsuite: * gcc.dg/redecl-11.c, gcc.dg/redecl-12.c, gcc.dg/redecl-13.c, gcc.dg/redecl-14.c, gcc.dg/redecl-15.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/redecl-14.c')
-rw-r--r--gcc/testsuite/gcc.dg/redecl-14.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/redecl-14.c b/gcc/testsuite/gcc.dg/redecl-14.c
new file mode 100644
index 00000000000..ed196106361
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/redecl-14.c
@@ -0,0 +1,22 @@
+/* Some incompatible external linkage declarations were not diagnosed.
+ Bug 21342. Test type in inner scope is correct. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef int IA[];
+typedef int IA5[5];
+typedef IA *IAP;
+typedef IA5 *IA5P;
+extern IAP a[];
+void
+f (void)
+{
+ {
+ extern IA5P a[];
+ sizeof (*a[0]);
+ }
+ extern IAP a[];
+ extern IAP a[5];
+ sizeof (*a[0]); /* { dg-error "error: invalid application of 'sizeof' to incomplete type 'IA'" } */
+}