[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-30 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 120913. lichray added a comment. Make the feature unconditional with an `ExtWarn` https://reviews.llvm.org/D39284 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/DeclSpec.h lib/Parse/ParseExprCXX.cpp lib/Sema/SemaDeclCXX.cpp t

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-30 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: include/clang/Sema/DeclSpec.h:2015 case ConditionContext: + return Lang.CPlusPlus2a; case MemberContext: If there's no grammar ambiguities here (and I don't think there are), please accept this uncondition

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. In https://reviews.llvm.org/D39284#906899, @aaron.ballman wrote: > We typically diagnose vendor extensions to the language, and I think we > should apply that consistently. Otherwise, your code will compile fine in > Clang with warning levels cranked all the way up and

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 120295. lichray added a comment. One more test case https://reviews.llvm.org/D39284 Files: include/clang/Sema/DeclSpec.h lib/Parse/ParseExprCXX.cpp lib/Sema/SemaDeclCXX.cpp test/Parser/cxx2a-decomposition.cpp test/SemaCXX/cxx2a-decomposition.cpp

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D39284#906889, @lichray wrote: > In https://reviews.llvm.org/D39284#906860, @aaron.ballman wrote: > > > I'm aware, but I was unaware that we've accepted this functionality in > > C++2a yet within WG21. Did we vote this in and I simply di

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. In https://reviews.llvm.org/D39284#906860, @aaron.ballman wrote: > I'm aware, but I was unaware that we've accepted this functionality in C++2a > yet within WG21. Did we vote this in and I simply didn't remember it? No. In the first line of the Summary I said this has

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In https://reviews.llvm.org/D39284#906800, @lichray wrote: > In https://reviews.llvm.org/D39284#906450, @aaron.ballman wrote: > > > I'm not opposed to the functionality, but this isn't a part of C++2a > > either; I think we should be diagnosing this code with a war

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. In https://reviews.llvm.org/D39284#906450, @aaron.ballman wrote: > I'm not opposed to the functionality, but this isn't a part of C++2a either; > I think we should be diagnosing this code with a warning so users don't > expect it to work on every compiler. C++2a the s

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. I'm not opposed to the functionality, but this isn't a part of C++2a either; I think we should be diagnosing this code with a warning so users don't expect it to work on every compiler. https://reviews.llvm.org/D39284 __

[PATCH] D39284: [c++2a] Decomposed _condition_

2017-10-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray created this revision. This feature was discussed but not yet proposed. It allows a structured binding to appear as a //condition// if (auto [ok, val] = f(...)) So the user can save an extra //condition// if the statement can query the value to-be-decomposed instead. Formally, it m