public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107805] New: Spurious warning after redefinition of type
@ 2022-11-22  9:19 fw at gcc dot gnu.org
  2022-11-22  9:27 ` [Bug c/107805] [12/13 Regression] Spurious “type defaults to ‘int’” " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: fw at gcc dot gnu.org @ 2022-11-22  9:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107805

            Bug ID: 107805
           Summary: Spurious warning after redefinition of type
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fw at gcc dot gnu.org
  Target Milestone: ---

With gcc-11.3.1-3.fc35.x86_64, this program

typedef int t;
typedef struct { double a; int b; } t;
t x;

produces:

t.c:2:37: error: conflicting types for ‘t’; have ‘struct <anonymous>’
    2 | typedef struct { double a; int b; } t;
      |                                     ^
t.c:1:13: note: previous declaration of ‘t’ with type ‘t’ {aka ‘int’}
    1 | typedef int t;
      |             ^

which is expected.  But with gcc-12.2.1-3.fc38.x86_64, I get this instead:

t.c:2:37: error: conflicting types for ‘t’; have ‘struct <anonymous>’
    2 | typedef struct { double a; int b; } t;
      |                                     ^
t.c:1:13: note: previous declaration of ‘t’ with type ‘t’ {aka ‘int’}
    1 | typedef int t;
      |             ^
t.c:3:3: warning: type defaults to ‘int’ in declaration of ‘x’ [-Wimplicit-int]
    3 | t x;
      |   ^

Note the spurious warning.  This causes problems with attempts to eliminate
implicit int, so it would be nice to fix this.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-08 12:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  9:19 [Bug c/107805] New: Spurious warning after redefinition of type fw at gcc dot gnu.org
2022-11-22  9:27 ` [Bug c/107805] [12/13 Regression] Spurious “type defaults to ‘int’” " rguenth at gcc dot gnu.org
2022-11-22  9:40 ` fw at gcc dot gnu.org
2022-11-22  9:43 ` redi at gcc dot gnu.org
2022-11-22  9:51 ` jakub at gcc dot gnu.org
2022-11-22  9:57 ` jakub at gcc dot gnu.org
2022-11-22 12:21 ` fw at gcc dot gnu.org
2022-11-24 10:02 ` cvs-commit at gcc dot gnu.org
2022-11-24 10:02 ` fw at gcc dot gnu.org
2023-05-08 12:26 ` [Bug c/107805] [12 " rguenth at gcc dot gnu.org

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).