consideration for C++17 for now. Update C++ status page to match.
llvm-svn: 222865
def warn_cxx98_compat_for_range : Warning<
"range-based for loop is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
-def ext_for_range_identifier : ExtWarn<
- "range-based for loop with implicit deduced type is a C++1z extension">,
- InGroup<CXX1z>;
-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<CXXPre1zCompat>, 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<
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());
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}}
}
}
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4086.html">N4086</a></td>
<td class="full" align="center">Clang 3.5</td>
</tr>
+ <!--
<tr>
- <td>Terse range-based for loops</td>
- <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3994.htm">N3994</a></td>
- <td class="full" align="center">Clang 3.5</td>
+ <td rowspan="2">Terse range-based for loops (removed from C++1z)</td>
+ <td rowspan="2"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3994.htm">N3994</a></td>
+ <td class="none" align="center">Clang 3.5: Yes</td>
+ </tr>
+ <tr>
+ <td class="svn" align="center">SVN: No</td>
</tr>
+ -->
<tr>
<td><tt>typename</tt> in a template template parameter</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4051.html">N4051</a></td>
<tr>
<td>New <tt>auto</tt> rules for direct-list-initialization
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3922.html">N3922</a></td>
- <td class="no" align="center">No</td>
+ <td class="none" align="center">No</td>
</tr>
<!-- Urbana papers -->
<tr>
</td>
</tr>
<tr>
- <td class="full" align="center">
+ <td class="svn" align="center">
SVN (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4200">N4200</a>)</a>
</td>
</tr>