[committed] testsuite: Add test for C90 auto with implicit int

Message ID ab2a758-711d-6d30-6561-a4189efff023@codesourcery.com
State Committed
Commit dc02d4a99a7073dbef193c93529f2e1b64addfe2
Headers
Series [committed] testsuite: Add test for C90 auto with implicit int |

Commit Message

Joseph Myers Dec. 7, 2022, 7:25 p.m. UTC
  Add a test for the case of auto with implicit int in C90 mode, which
is incompatible with C2x semantics (I missed adding such a test when
implementing C2x auto).

Tested for x86_64-pc-linux-gnu.

	* gcc.dg/c90-auto-1.c: New test.
  

Patch

diff --git a/gcc/testsuite/gcc.dg/c90-auto-1.c b/gcc/testsuite/gcc.dg/c90-auto-1.c
new file mode 100644
index 00000000000..f00f767c50a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-auto-1.c
@@ -0,0 +1,12 @@ 
+/* Test auto with implicit int for C90.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c90 -pedantic-errors" } */
+
+void
+f (void)
+{
+  /* This should have type int following C90 rules, whereas in C2x it
+     would have type double.  */
+  auto x = 1.5;
+  int *p = &x;
+}