[PATCH 0/3] P1997 'array-copy' patchset [PR103238]

Will Wray wjwray@gmail.com
Mon Nov 22 02:51:11 GMT 2021


([PATCH 1/3] already submitted fix for PR c++/55227, is a dependency here.)

These patches implement C++ proposal P1997 "Relaxing restrictions on array"
that adds:

  C array copy semantics:
    * array-array initializations
    * array-array assignments
    * array return-by-value from functions
     (array formal parameters are unchanged; there's no pass-by-value).

  Plus, C++ specific:
    * array pseudo-destructors
    * array element type deduction
     (i.e. admitting placeholder auto in array variable declarations).

The features are added as an experimental extension, disabled by default.
The patches should have no effect until enabled by the new option:

    -farray-copy (flag_array_copy, a single flag to enable all features)

The extension is documented as experimental with no guarantee of stability;
features may be added, removed or changed in detail. In particular, there's
no guarantee of ABI stability; allowing array as a function return type has
ABI implications for calling conventions of the array return slot and, for
C++, name-mangling conventions must be defined.

The plan is to first merge array-copy as experimental, with ABI defined as
'what the code does', and then to go ahead with ABI work.

Will Wray (3):
  c++: designated init of char array by string constant [PR55227]
  c++: P1997 array-copy extensions: Initialization [PR103238]
  c++: P1997 array-copy extensions: Assignment, return, etc. [PR103238]

 gcc/c-family/c-common.c                  |   5 ++
 gcc/c-family/c.opt                       |   4 ++
 gcc/c/c-decl.c                           |   2 +-
 gcc/cp/call.c                            |  43 +++++++-----
 gcc/cp/decl.c                            | 111 ++++++++++++++++++-------------
 gcc/cp/init.c                            |   6 +-
 gcc/cp/parser.c                          |   4 +-
 gcc/cp/pt.c                              |  13 +++-
 gcc/cp/tree.c                            |   3 +-
 gcc/cp/typeck.c                          |  35 ++++++++--
 gcc/cp/typeck2.c                         |  30 ++++++---
 gcc/doc/invoke.texi                      |   6 ++
 gcc/testsuite/g++.dg/cpp2a/desig20.C     |  48 +++++++++++++
 gcc/testsuite/g++.dg/init/array-copy1.C  |  66 ++++++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy10.C |  57 ++++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy11.C |  13 ++++
 gcc/testsuite/g++.dg/init/array-copy12.C |  79 ++++++++++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy2.C  |  68 +++++++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy3.C  |  41 ++++++++++++
 gcc/testsuite/g++.dg/init/array-copy4.C  |  42 ++++++++++++
 gcc/testsuite/g++.dg/init/array-copy5.C  |  36 ++++++++++
 gcc/testsuite/g++.dg/init/array-copy6.C  |  51 ++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy7.C  |  40 +++++++++++
 gcc/testsuite/g++.dg/init/array-copy8.C  |  56 ++++++++++++++++
 gcc/testsuite/g++.dg/init/array-copy9.C  |  57 ++++++++++++++++
 25 files changed, 835 insertions(+), 81 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp2a/desig20.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy1.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy10.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy11.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy12.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy2.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy3.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy4.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy5.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy6.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy7.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy8.C
 create mode 100644 gcc/testsuite/g++.dg/init/array-copy9.C

-- 
2.31.1



More information about the Gcc-patches mailing list