public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration
@ 2015-07-19  1:54 anders.granlund.0 at gmail dot com
  2015-07-19 13:33 ` [Bug c++/66934] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-19  1:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66934
           Summary: Compiler accepting ill-formed program with extern
                    variable declarations and using-declaration
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anders.granlund.0 at gmail dot com
  Target Milestone: ---

The following program is ill-formed since the two declarations in main are
conflicting.

  namespace N {
      extern int x;
  }

  int main() {
      using N::x;
      extern int x;
  }

GCC compiles with program without errors. The expected behaviour is to get a
compiler error.


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
@ 2015-07-19 13:33 ` redi at gcc dot gnu.org
  2015-07-19 21:42 ` anders.granlund.0 at gmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-19 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think we could combine most of your reports into one or two PRs since they're
all related and fixing them one by one would probably not be very efficient.


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
  2015-07-19 13:33 ` [Bug c++/66934] " redi at gcc dot gnu.org
@ 2015-07-19 21:42 ` anders.granlund.0 at gmail dot com
  2015-07-19 22:53 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-19 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> I think we could combine most of your reports into one or two PRs since
> they're all related and fixing them one by one would probably not be very
> efficient.

What is a PR?


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
  2015-07-19 13:33 ` [Bug c++/66934] " redi at gcc dot gnu.org
  2015-07-19 21:42 ` anders.granlund.0 at gmail dot com
@ 2015-07-19 22:53 ` redi at gcc dot gnu.org
  2015-07-27  1:15 ` anders.granlund.0 at gmail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-19 22:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Problem report i.e. bugzilla bug.


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (2 preceding siblings ...)
  2015-07-19 22:53 ` redi at gcc dot gnu.org
@ 2015-07-27  1:15 ` anders.granlund.0 at gmail dot com
  2015-07-27  1:16 ` anders.granlund.0 at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-27  1:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
I'm pulling in this test case from my related bug report.

  int x = 1;

  int main() {
      extern int x;
      using ::x;
  }

I this case the program is well-formed (the two declarations in main are not
conflicting), but error messages are still given:

  prog.cc: In function 'int main()':
  prog.cc:5:13: error: redeclaration of 'int x'
       using ::x;
               ^
  prog.cc:4:16: note: previous declaration 'int x'
       extern int x;
                  ^


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (3 preceding siblings ...)
  2015-07-27  1:15 ` anders.granlund.0 at gmail dot com
@ 2015-07-27  1:16 ` anders.granlund.0 at gmail dot com
  2015-07-27  1:18 ` anders.granlund.0 at gmail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-27  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
*** Bug 66935 has been marked as a duplicate of this bug. ***


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (4 preceding siblings ...)
  2015-07-27  1:16 ` anders.granlund.0 at gmail dot com
@ 2015-07-27  1:18 ` anders.granlund.0 at gmail dot com
  2015-07-27  1:38 ` anders.granlund.0 at gmail dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-27  1:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> Problem report i.e. bugzilla bug.

Ok. Done.


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (5 preceding siblings ...)
  2015-07-27  1:18 ` anders.granlund.0 at gmail dot com
@ 2015-07-27  1:38 ` anders.granlund.0 at gmail dot com
  2021-12-03  0:45 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-27  1:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Anders Granlund <anders.granlund.0 at gmail dot com> ---
(In reply to Anders Granlund from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > I think we could combine most of your reports into one or two PRs since
> > they're all related and fixing them one by one would probably not be very
> > efficient.
> 
> What is a PR?

I have now pulled in 66935 into this report. I have also pulled in 66878 66888
66889 66901 into 66879. This reduces 7 of my bug reports to 2 bug reports.

I have currently 9 other bug reports open, but I think they are quite separate.


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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (6 preceding siblings ...)
  2015-07-27  1:38 ` anders.granlund.0 at gmail dot com
@ 2021-12-03  0:45 ` pinskia at gcc dot gnu.org
  2021-12-03  0:46 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-03  0:45 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=66878,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=66888,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=66889,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=66901,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=66935

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Anders Granlund from comment #0)
> The following program is ill-formed since the two declarations in main are
> conflicting.

This was fixed in GCC 8+.

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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (7 preceding siblings ...)
  2021-12-03  0:45 ` pinskia at gcc dot gnu.org
@ 2021-12-03  0:46 ` pinskia at gcc dot gnu.org
  2021-12-03  0:55 ` pinskia at gcc dot gnu.org
  2021-12-09  9:18 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-03  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Anders Granlund from comment #4)
> I'm pulling in this test case from my related bug report.
> 
>   int x = 1;
> 
>   int main() {
>       extern int x;
>       using ::x;
>   }

This is unrelated to the first testcase though.

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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (8 preceding siblings ...)
  2021-12-03  0:46 ` pinskia at gcc dot gnu.org
@ 2021-12-03  0:55 ` pinskia at gcc dot gnu.org
  2021-12-09  9:18 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-03  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.1.0
   Last reconfirmed|                            |2021-12-03
      Known to fail|                            |7.5.0
   Target Milestone|---                         |8.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|rejects-valid               |needs-bisection

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

* [Bug c++/66934] Compiler accepting ill-formed program with extern variable declarations and using-declaration
  2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
                   ` (9 preceding siblings ...)
  2021-12-03  0:55 ` pinskia at gcc dot gnu.org
@ 2021-12-09  9:18 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |marxin at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed with r8-872-g3a9cc6853ad1a188.

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

end of thread, other threads:[~2021-12-09  9:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-19  1:54 [Bug c++/66934] New: Compiler accepting ill-formed program with extern variable declarations and using-declaration anders.granlund.0 at gmail dot com
2015-07-19 13:33 ` [Bug c++/66934] " redi at gcc dot gnu.org
2015-07-19 21:42 ` anders.granlund.0 at gmail dot com
2015-07-19 22:53 ` redi at gcc dot gnu.org
2015-07-27  1:15 ` anders.granlund.0 at gmail dot com
2015-07-27  1:16 ` anders.granlund.0 at gmail dot com
2015-07-27  1:18 ` anders.granlund.0 at gmail dot com
2015-07-27  1:38 ` anders.granlund.0 at gmail dot com
2021-12-03  0:45 ` pinskia at gcc dot gnu.org
2021-12-03  0:46 ` pinskia at gcc dot gnu.org
2021-12-03  0:55 ` pinskia at gcc dot gnu.org
2021-12-09  9:18 ` marxin 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).