public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63985] New: Accepts invalid range-based for declaration
@ 2014-11-20  1:00 R.HL at gmx dot net
  2014-11-20 10:09 ` [Bug c++/63985] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: R.HL at gmx dot net @ 2014-11-20  1:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63985
           Summary: Accepts invalid range-based for declaration
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: R.HL at gmx dot net

int arr[] {1, 2, 3};
    for (int i = 5: arr)
        std::cout << i << ", ";

Compiles, while it shouldn't. A warning message suggests that GCC ignores the
loop completely.

    warning: variable 'arr' set but not used

Perhaps GCC can't decide what kind of loop this is and decides to ignore it
silently?


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

* [Bug c++/63985] Accepts invalid range-based for declaration
  2014-11-20  1:00 [Bug c++/63985] New: Accepts invalid range-based for declaration R.HL at gmx dot net
@ 2014-11-20 10:09 ` redi at gcc dot gnu.org
  2014-12-04  9:57 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-20 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-20
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed

int main()
{
  int arr;
  for (int i = 5: arr)
    return 1;
  return 0;
}


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

* [Bug c++/63985] Accepts invalid range-based for declaration
  2014-11-20  1:00 [Bug c++/63985] New: Accepts invalid range-based for declaration R.HL at gmx dot net
  2014-11-20 10:09 ` [Bug c++/63985] " redi at gcc dot gnu.org
@ 2014-12-04  9:57 ` paolo.carlini at oracle dot com
  2014-12-24  9:08 ` paolo at gcc dot gnu.org
  2014-12-24  9:22 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-12-04  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
              Build|g++ -std=c++11 -Wall        |
                   |-Wextra -pedantic           |

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/63985] Accepts invalid range-based for declaration
  2014-11-20  1:00 [Bug c++/63985] New: Accepts invalid range-based for declaration R.HL at gmx dot net
  2014-11-20 10:09 ` [Bug c++/63985] " redi at gcc dot gnu.org
  2014-12-04  9:57 ` paolo.carlini at oracle dot com
@ 2014-12-24  9:08 ` paolo at gcc dot gnu.org
  2014-12-24  9:22 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-12-24  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Dec 24 09:07:23 2014
New Revision: 219054

URL: https://gcc.gnu.org/viewcvs?rev=219054&root=gcc&view=rev
Log:
/cp
2014-12-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/63985
    * parser.c (cp_parser_for_init_statement): Reject invalid declarations
    in range-based for loops.

/testsuite
2014-12-04  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/63985
    * g++.dg/cpp0x/range-for29.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/range-for29.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/63985] Accepts invalid range-based for declaration
  2014-11-20  1:00 [Bug c++/63985] New: Accepts invalid range-based for declaration R.HL at gmx dot net
                   ` (2 preceding siblings ...)
  2014-12-24  9:08 ` paolo at gcc dot gnu.org
@ 2014-12-24  9:22 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-12-24  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |5.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 5.0.


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

end of thread, other threads:[~2014-12-24  9:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20  1:00 [Bug c++/63985] New: Accepts invalid range-based for declaration R.HL at gmx dot net
2014-11-20 10:09 ` [Bug c++/63985] " redi at gcc dot gnu.org
2014-12-04  9:57 ` paolo.carlini at oracle dot com
2014-12-24  9:08 ` paolo at gcc dot gnu.org
2014-12-24  9:22 ` 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).