From: Ville Voutilainen <ville.voutilainen@gmail.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Jason Merrill <jason@redhat.com>
Subject: [C++ PATCH] Remove the implementation of N3994, terse range-for loops.
Date: Sat, 31 Oct 2015 11:01:00 -0000 [thread overview]
Message-ID: <CAFk2RUb5D0nLETyyd+EAWNyKW=qZvH_PppVdaLG-ECA-iPGSTg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
Since N3994 ended up being rejected and was never included
in C++17, I want to remove the support for it. It's easy to bring
it back if such a facility is resurrected, but for now, let's remove
such an extension.
Tested on Linux-PPC64.
/cp
2015-10-31 Ville Voutilainen <ville.voutilainen@gmail.com>
Remove the implementation of N3994, terse range-for loops.
* parser.c (cp_parser_for_init_statement): Remove the parsing
of a terse range-for.
/testsuite
2015-10-31 Ville Voutilainen <ville.voutilainen@gmail.com>
Remove the implementation of N3994, terse range-for loops.
* g++.dg/cpp1z/range-for1.C: Remove.
[-- Attachment #2: remove-terse-range-for.diff --]
[-- Type: text/plain, Size: 1463 bytes --]
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c8f8b3d..8ca82d3 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11279,22 +11279,6 @@ cp_parser_for_init_statement (cp_parser* parser, tree *decl)
bool is_range_for = false;
bool saved_colon_corrects_to_scope_p = parser->colon_corrects_to_scope_p;
- if (cp_lexer_next_token_is (parser->lexer, CPP_NAME)
- && cp_lexer_nth_token_is (parser->lexer, 2, CPP_COLON))
- {
- /* N3994 -- for (id : init) ... */
- if (cxx_dialect < cxx1z)
- pedwarn (input_location, 0, "range-based for loop without a "
- "type-specifier only available with "
- "-std=c++1z or -std=gnu++1z");
- tree name = cp_parser_identifier (parser);
- tree type = cp_build_reference_type (make_auto (), /*rval*/true);
- *decl = build_decl (input_location, VAR_DECL, name, type);
- pushdecl (*decl);
- cp_lexer_consume_token (parser->lexer);
- return true;
- }
-
/* A colon is used in range-based for. */
parser->colon_corrects_to_scope_p = false;
diff --git a/gcc/testsuite/g++.dg/cpp1z/range-for1.C b/gcc/testsuite/g++.dg/cpp1z/range-for1.C
deleted file mode 100644
index 7e6d055..0000000
--- a/gcc/testsuite/g++.dg/cpp1z/range-for1.C
+++ /dev/null
@@ -1,12 +0,0 @@
-// { dg-options "-std=c++1z -pedantic-errors" }
-
-extern "C" int printf (const char *, ...);
-#include <initializer_list>
-
-int main()
-{
- for (i : {1,2})
- {
- printf ("%d ", i);
- }
-}
next reply other threads:[~2015-10-31 10:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-31 11:01 Ville Voutilainen [this message]
2015-10-31 17:11 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFk2RUb5D0nLETyyd+EAWNyKW=qZvH_PppVdaLG-ECA-iPGSTg@mail.gmail.com' \
--to=ville.voutilainen@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).