public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108013] New: `extern "C" int t = 1;` warns about being declared as extern and initialized
@ 2022-12-07 19:35 pinskia at gcc dot gnu.org
  2022-12-07 20:00 ` [Bug c++/108013] " manx-bugzilla at problemloesungsmaschine dot de
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-07 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108013
           Summary: `extern "C" int t = 1;` warns about being declared as
                    extern and initialized
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

I don't think we should warn about this case:
```
extern "C" int h = 1; 
```

We should warn for:
```
extern int h = 1; 
```
Though.

We already don't warn for:
```
extern "C" { int h = 1; }
```
Which is a small workaround but I don't think it is needed though.

Forwarded from bug 45977 comment #8 .

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

* [Bug c++/108013] `extern "C" int t = 1;` warns about being declared as extern and initialized
  2022-12-07 19:35 [Bug c++/108013] New: `extern "C" int t = 1;` warns about being declared as extern and initialized pinskia at gcc dot gnu.org
@ 2022-12-07 20:00 ` manx-bugzilla at problemloesungsmaschine dot de
  0 siblings, 0 replies; 2+ messages in thread
From: manx-bugzilla at problemloesungsmaschine dot de @ 2022-12-07 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jörn Heusipp <manx-bugzilla at problemloesungsmaschine dot de> ---
Thanks for the work-around with using a extern "C" {} block. That's actually
way better than the extra .c file that I did use.

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

end of thread, other threads:[~2022-12-07 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 19:35 [Bug c++/108013] New: `extern "C" int t = 1;` warns about being declared as extern and initialized pinskia at gcc dot gnu.org
2022-12-07 20:00 ` [Bug c++/108013] " manx-bugzilla at problemloesungsmaschine dot de

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