public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51454] New: For loop improper scoping
@ 2011-12-07 17:54 pubby.8 at gmail dot com
  2011-12-07 19:19 ` [Bug c++/51454] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pubby.8 at gmail dot com @ 2011-12-07 17:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51454

             Bug #: 51454
           Summary: For loop improper scoping
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pubby.8@gmail.com


gcc version 4.7.0 20111203 (experimental) (GCC) 

This worked on 4.6, but isn't on 4.7:

for(float x = 0.0f; int x = 0;); 

error: redeclaration of ‘int x’
error: ‘float x’ previously declared here

It should be equivalent to this which compiles correctly:

{
  float x = 0.0f;
  while (int x = 0) { ; }
}


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

* [Bug c++/51454] For loop improper scoping
  2011-12-07 17:54 [Bug c++/51454] New: For loop improper scoping pubby.8 at gmail dot com
@ 2011-12-07 19:19 ` paolo.carlini at oracle dot com
  2011-12-07 22:37 ` pubby.8 at gmail dot com
  2011-12-07 23:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-07 19:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51454

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-07 19:19:17 UTC ---
Note that ICC and Comeau also reject it in strict mode.


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

* [Bug c++/51454] For loop improper scoping
  2011-12-07 17:54 [Bug c++/51454] New: For loop improper scoping pubby.8 at gmail dot com
  2011-12-07 19:19 ` [Bug c++/51454] " paolo.carlini at oracle dot com
@ 2011-12-07 22:37 ` pubby.8 at gmail dot com
  2011-12-07 23:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pubby.8 at gmail dot com @ 2011-12-07 22:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51454

Pubby8 <pubby.8 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
           Severity|normal                      |trivial

--- Comment #2 from Pubby8 <pubby.8 at gmail dot com> 2011-12-07 22:36:53 UTC ---
Actually I seem to have been mistaken:

"names declared in the for-init-statement are in the same declarative-region as
those declared in the condition"

Going to mark this as resolved as GCC seems to have the correct behavior.


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

* [Bug c++/51454] For loop improper scoping
  2011-12-07 17:54 [Bug c++/51454] New: For loop improper scoping pubby.8 at gmail dot com
  2011-12-07 19:19 ` [Bug c++/51454] " paolo.carlini at oracle dot com
  2011-12-07 22:37 ` pubby.8 at gmail dot com
@ 2011-12-07 23:29 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-07 23:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51454

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME
           Severity|trivial                     |normal


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

end of thread, other threads:[~2011-12-07 23:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 17:54 [Bug c++/51454] New: For loop improper scoping pubby.8 at gmail dot com
2011-12-07 19:19 ` [Bug c++/51454] " paolo.carlini at oracle dot com
2011-12-07 22:37 ` pubby.8 at gmail dot com
2011-12-07 23:29 ` paolo.carlini at oracle dot com

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