public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4542] testsuite: Add test for C90 auto with implicit int
@ 2022-12-07 19:25 Joseph Myers
  0 siblings, 0 replies; only message in thread
From: Joseph Myers @ 2022-12-07 19:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:dc02d4a99a7073dbef193c93529f2e1b64addfe2

commit r13-4542-gdc02d4a99a7073dbef193c93529f2e1b64addfe2
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Dec 7 19:24:45 2022 +0000

    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.

Diff:
---
 gcc/testsuite/gcc.dg/c90-auto-1.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07 19:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 19:25 [gcc r13-4542] testsuite: Add test for C90 auto with implicit int Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).