[PATCH] D58934: [clang-format] Fix lambdas returning template specialization that contains operator in parameter

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 15:46:18 PST 2019


jkorous created this revision.
jkorous added reviewers: klimek, djasper, JonasToth, alexfh, krasimir, MyDeveloperDay.
Herald added subscribers: cfe-commits, jdoerfert, dexonsmith.
Herald added a project: clang.

Inspired by https://reviews.llvm.org/D58922

Since this code compiles I assume we should add those tokens to switch:

  template<int> struct foo {};
  
  int main() {
    { auto lambda = []() -> foo<5+2> { return {}; }; }
    { auto lambda = []() -> foo<5-2> { return {}; }; }
    { auto lambda = []() -> foo<5/3> { return {}; }; }
    { auto lambda = []() -> foo<5%2> { return {}; }; }
    { auto lambda = []() -> foo<5<<2> { return {}; }; }
    { auto lambda = []() -> foo<!false> { return {}; }; }
    { auto lambda = []() -> foo<~5> { return {}; }; }
    { auto lambda = []() -> foo<5|2> { return {}; }; }
    { auto lambda = []() -> foo<5||2> { return {}; }; }
    { auto lambda = []() -> foo<5&2> { return {}; }; }
    { auto lambda = []() -> foo<5&&2> { return {}; }; }
    { auto lambda = []() -> foo<5==2> { return {}; }; }
    { auto lambda = []() -> foo<5!=2> { return {}; }; }
    { auto lambda = []() -> foo<5>=2> { return {}; }; }
    { auto lambda = []() -> foo<5<2> { return {}; }; }
    { auto lambda = []() -> foo<5<=2> { return {}; }; }
    { auto lambda = []() -> foo<2 ? 1 : 0> { return {}; }; }
  }


Repository:
  rC Clang

https://reviews.llvm.org/D58934

Files:
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58934.189223.patch
Type: text/x-patch
Size: 5533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190304/4067ca65/attachment.bin>


More information about the cfe-commits mailing list