[PATCH] D69577: [clang-format] [PR35518] C++17 deduction guides are wrongly formatted
Zhihao Yuan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 30 09:49:15 PDT 2019
lichray added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1400
Current.Type = TT_TrailingReturnArrow;
+ } else if (Current.Previous && Current.Previous->is(tok::r_paren) &&
+ Current.startsSequence(tok::arrow, tok::identifier, tok::less)) {
----------------
klimek wrote:
> Why doesn't this trigger on function templates:
> c()->f<int>();
>
Comparing to the `else if` branch above, several questions can arise:
1. Has deduction-guide be considered a declaration (it is, of course, in standard)? If yes, without `MustBeDeclaration`, how `x = p->foo<3>();` being formatted?
2. Without restrictions on `NestingLevel`, how `A() -> A<decltype(p->foo<3>())>;` being formatted?
3. How `x()->foo<1>;` being formatted? What's the difference between this and a deduction-guide? A deduction-guide has to follow `TheSameType(...) -> TheSameType<....>;` and appears only at namespace level, do these help?
Oh no, `auto x = p -> foo<1>();` this is a bug (I will look for bug reports, don't mind).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69577/new/
https://reviews.llvm.org/D69577
More information about the cfe-commits
mailing list