aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2022-12-07 19:24:45 +0000
committerJoseph Myers <joseph@codesourcery.com>2022-12-07 19:24:45 +0000
commitdc02d4a99a7073dbef193c93529f2e1b64addfe2 (patch)
tree78e261fa6a989a779d8577cee9d52a93b1d386f9 /gcc
parentce53cf7b61ea6bce05570e2fd1f8c10eee308ab0 (diff)
downloadgcc-dc02d4a99a7073dbef193c93529f2e1b64addfe2.zip
gcc-dc02d4a99a7073dbef193c93529f2e1b64addfe2.tar.gz
gcc-dc02d4a99a7073dbef193c93529f2e1b64addfe2.tar.bz2
testsuite: Add test for C90 auto with implicit int
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/c90-auto-1.c12
1 files changed, 12 insertions, 0 deletions
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 0000000..f00f767
--- /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;
+}