[PATCH] D65043: [Format] Add C++20 standard to style options
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 26 08:58:48 PDT 2019
Quuxplusone added inline comments.
================
Comment at: clang/unittests/Format/FormatTest.cpp:13815
+ verifyFormat("co_yield++ i;");
+ verifyFormat("co_yield ++i;", Cpp20);
+
----------------
modocache wrote:
> Quuxplusone wrote:
> > If you're going to test C++11's behavior here, please use `co_yield - 1;` or something else that might reasonably appear in a C++11 program. `co_yield++ i;` is not valid C++ (unless `i` is a macro, I guess).
> `i` would be an iterator in this case.
No matter what `i` is, `co_yield++ i;` is never a valid sequence of tokens in C++17 (unless `i` is a macro, I guess).
`co_yield ++i;` will become valid in C++2a, but if you see that sequence of tokens in any C++ program ever, you can just assume that it is C++2a. There is never any reason to think that it should be formatted as `co_yield++ i;`, because that would not be valid C++17.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65043/new/
https://reviews.llvm.org/D65043
More information about the cfe-commits
mailing list