[PATCH] D39284: Allow conditions to be decomposed with structured bindings
Zhihao Yuan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 3 04:12:43 PST 2017
lichray added inline comments.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:712-720
+ Diag(Decomp.getLSquareLoc(), [&] {
+ if (getLangOpts().CPlusPlus1z) {
+ if (D.getContext() == Declarator::ConditionContext)
+ return diag::ext_decomp_decl_cond;
+ else
+ return diag::warn_cxx14_compat_decomp_decl;
+ } else
----------------
rsmith wrote:
> Using a lambda here seems like unwarranted complexity. A three-way ternary of the form
>
> ```
> !getLangOpts().CPlusPlus1z ? diag::ext_decomp_decl :
> D.getContext() == Declarator::ConditionContext ? diag::ext_decomp_decl_cond :
> diag::warn_cxx14_compat_decomp_decl
> ```
>
> would be fine. Feel free to ignore clang-format if it wants to format it stupidly.
The clang-formatted code actually looks good.
================
Comment at: test/Misc/warning-flags.c:19
The list of warnings below should NEVER grow. It should gradually shrink to 0.
----------------
rsmith wrote:
> Please read and respect this rule :)
Do you know of some categories which can cover this kind of extensions?
Repository:
rC Clang
https://reviews.llvm.org/D39284
More information about the cfe-commits
mailing list