if (Tok.Next->is(tok::question))
return false;
+ // `foreach((A a, B b) in someList)` should not be seen as a cast.
+ if (Tok.Next->is(Keywords.kw_in) && Style.isCSharp())
+ return false;
+
// Functions which end with decorations like volatile, noexcept are unlikely
// to be casts.
if (Tok.Next->isOneOf(tok::kw_noexcept, tok::kw_volatile, tok::kw_const,
Style.SpaceBeforeCpp11BracedList = true;
Style.Cpp11BracedListStyle = false;
Style.SpacesInContainerLiterals = false;
+ Style.SpaceAfterCStyleCast = false;
verifyFormat(R"(new Car { "Door", 0.1 })", Style);
verifyFormat(R"(new Car { 0.1, "Door" })", Style);
verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style);
+ // Not seen as a C-style cast.
+ verifyFormat(R"(//
+foreach ((A a, B b) in someList) {
+})",
+ Style);
+
Style.SpacesInSquareBrackets = true;
verifyFormat(R"(private float[ , ] Values;)", Style);
verifyFormat(R"(string dirPath = args?[ 0 ];)", Style);