From: Richard Smith
Date: Thu, 27 Nov 2014 01:54:27 +0000 (+0000)
Subject: [c++1z] Remove terse range-based for loops; they've been removed from
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=83d3f150c86a7fe86ebabc44f34ceca0979725cb;p=platform%2Fupstream%2Fllvm.git
[c++1z] Remove terse range-based for loops; they've been removed from
consideration for C++17 for now. Update C++ status page to match.
llvm-svn: 222865
---
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 7a9d8dd..759bcda 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -290,13 +290,8 @@ def ext_for_range : ExtWarn<
def warn_cxx98_compat_for_range : Warning<
"range-based for loop is incompatible with C++98">,
InGroup, DefaultIgnore;
-def ext_for_range_identifier : ExtWarn<
- "range-based for loop with implicit deduced type is a C++1z extension">,
- InGroup;
-def warn_cxx14_compat_for_range_identifier : Warning<
- "range-based for loop with implicit deduced type is incompatible with "
- "C++ standards before C++1z">,
- InGroup, DefaultIgnore;
+def err_for_range_identifier : Error<
+ "range-based for loop requires type for loop variable">;
def err_for_range_expected_decl : Error<
"for range declaration must declare a variable">;
def err_argument_required_after_attribute : Error<
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 1bfce60..752baf6 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1520,9 +1520,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
else
ForRangeInit.RangeExpr = ParseExpression();
- Diag(Loc, getLangOpts().CPlusPlus1z
- ? diag::warn_cxx14_compat_for_range_identifier
- : diag::ext_for_range_identifier)
+ Diag(Loc, diag::err_for_range_identifier)
<< ((getLangOpts().CPlusPlus11 && !getLangOpts().CPlusPlus1z)
? FixItHint::CreateInsertion(Loc, "auto &&")
: FixItHint());
diff --git a/clang/test/SemaCXX/for-range-examples.cpp b/clang/test/SemaCXX/for-range-examples.cpp
index 2f777fb..d07331c 100644
--- a/clang/test/SemaCXX/for-range-examples.cpp
+++ b/clang/test/SemaCXX/for-range-examples.cpp
@@ -214,17 +214,19 @@ namespace test6 {
namespace test7 {
void f() {
int arr[5], b;
- for (a : arr) {} // expected-warning {{extension}}
- // FIXME: Give a -Wshadow for this by default?
- for (b : arr) {} // expected-warning {{extension}}
- for (arr : arr) {} // expected-warning {{extension}}
- for (c alignas(8) : arr) { // expected-warning {{extension}}
+ for (a : arr) {} // expected-error {{requires type for loop variable}}
+ // FIXME: Give a different error in this case?
+ for (b : arr) {} // expected-error {{requires type for loop variable}}
+ for (arr : arr) {} // expected-error {{requires type for loop variable}}
+ for (c alignas(8) : arr) { // expected-error {{requires type for loop variable}}
static_assert(alignof(c) == 8, ""); // expected-warning {{extension}}
}
- // FIXME: We should reject this, but don't, because we only check the
- // attribute before we deduce the 'auto' type.
- for (d alignas(1) : arr) {} // expected-warning {{extension}}
- for (e [[deprecated]] : arr) { e = 0; } // expected-warning {{deprecated}} expected-note {{here}} expected-warning {{extension}}
+ // FIXME: The fix-it hint here is not sufficient to fix the error.
+ // We fail to diagnose that d is underaligned for its type, because
+ // we check the alignment attribute before we perform the auto
+ // deduction.
+ for (d alignas(1) : arr) {} // expected-error {{requires type for loop variable}}
+ for (e [[deprecated]] : arr) { e = 0; } // expected-warning {{deprecated}} expected-note {{here}} expected-error {{requires type for loop variable}}
}
}
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 7b6fac0..41c827e 100644
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -536,11 +536,16 @@ as the draft C++1z standard evolves.
N4086 |
Clang 3.5 |
+
typename in a template template parameter |
N4051 |
@@ -549,7 +554,7 @@ as the draft C++1z standard evolves.
New auto rules for direct-list-initialization
| N3922 |
- No |
+ No |
@@ -600,7 +605,7 @@ Clang version they became available:
-
+ |
SVN (N4200)
|