From cb51cf409b45ddaa1bd16b1d88185b918c02bbdd Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Thu, 16 Jan 2014 09:11:55 +0000 Subject: clang-format: Enable formatting of lambdas with explicit return type. So clang-format can now format: int c = []()->int { return 2; }(); int c = []()->vector { return { 2 }; }(); llvm-svn: 199368 --- clang/unittests/Format/FormatTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/unittests/Format/FormatTest.cpp') diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 32e70700fa3..910df459761 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -7890,6 +7890,10 @@ TEST_F(FormatTest, FormatsLambdas) { " [&](int, int) { return 1; });\n" "}\n"); + // Lambdas with return types. + verifyFormat("int c = []()->int { return 2; }();\n"); + verifyFormat("int c = []()->vector { return { 2 }; }();\n"); + // Not lambdas. verifyFormat("constexpr char hello[]{ \"hello\" };"); verifyFormat("double &operator[](int i) { return 0; }\n" -- cgit v1.2.3