Commit Graph

5 Commits

Author SHA1 Message Date
Richard Smith 7c7e531f97 PR31978: Don't crash if CodeGen sees a top-level BindingDecl.
llvm-svn: 345362
2018-10-26 03:21:20 +00:00
Zhihao Yuan c81f4538ec Allow conditions to be decomposed with structured bindings
Summary:
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 test the value to-be-decomposed instead.  Formally, it makes the value of the underlying object of the structured binding declaration also the value of a //condition// that is an initialized declaration.

Considering its logicality which is entirely evident from its trivial implementation, I think it might be acceptable to land it as an extension for now before I write the paper.

Reviewers: rsmith, faisalv, aaron.ballman

Reviewed By: rsmith

Subscribers: aaron.ballman, cfe-commits

Differential Revision: https://reviews.llvm.org/D39284

llvm-svn: 320011
2017-12-07 07:03:15 +00:00
Richard Smith 4b46cb9190 [c++17] P0490R0, NB comment FI 20: allow direct-initialization of decomposition declarations.
llvm-svn: 289286
2016-12-09 22:56:20 +00:00
Richard Smith 7873de0cf6 P0217R3: Perform semantic checks and initialization for the bindings in a
decomposition declaration for arrays, aggregate-like structs, tuple-like
types, and (as an extension) for complex and vector types.

llvm-svn: 278435
2016-08-11 22:25:46 +00:00
Richard Smith bdb84f374c P0217R3: Parsing support and framework for AST representation of C++1z
decomposition declarations.

There are a couple of things in the wording that seem strange here:
decomposition declarations are permitted at namespace scope (which we partially
support here) and they are permitted as the declaration in a template (which we
reject).

llvm-svn: 276492
2016-07-22 23:36:59 +00:00