Skip to content

Instantly share code, notes, and snippets.

@CaseyCarter
Created November 19, 2015 03:39
Show Gist options
  • Select an option

  • Save CaseyCarter/a59628a17c07e72436fb to your computer and use it in GitHub Desktop.

Select an option

Save CaseyCarter/a59628a17c07e72436fb to your computer and use it in GitHub Desktop.
Ranges TS iterator sentinel hack for GCC trunk
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c (revision 230588)
+++ gcc/cp/parser.c (working copy)
@@ -10963,7 +10963,7 @@
LOOKUP_ONLYCONVERTING);
end = build_decl (input_location, VAR_DECL,
- get_identifier ("__for_end"), iter_type);
+ get_identifier ("__for_end"), cv_unqualified (TREE_TYPE (end_expr))); // CMCHACK: iter_type);
TREE_USED (end) = 1;
DECL_ARTIFICIAL (end) = 1;
pushdecl (end);
@@ -11096,10 +11096,12 @@
tree iter_type = cv_unqualified (TREE_TYPE (*begin));
/* The unqualified type of the __begin and __end temporaries should
be the same, as required by the multiple auto declaration. */
+#if 0 // CMCHACKHACK
if (!same_type_p (iter_type, cv_unqualified (TREE_TYPE (*end))))
error ("inconsistent begin/end types in range-based %<for%> "
"statement: %qT and %qT",
TREE_TYPE (*begin), TREE_TYPE (*end));
+#endif
return iter_type;
}
}
@CaseyCarter
Copy link
Author

This patch text is presumably short enough for "fair use" to apply, but I'm no lawyer. So here's the license header from parser.c:

Copyright (C) 2000-2015 Free Software Foundation, Inc.
Written by Mark Mitchell <[email protected]>.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment