diff options
author | Jason Merrill <jason@redhat.com> | 2020-07-07 01:41:35 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-07-20 17:54:18 -0400 |
commit | 812798917c59e95405a71b31ab37bd78c0f43f79 (patch) | |
tree | 7819648c4081fc5e37fba3b3ae505472d5023bd0 /COPYING3 | |
parent | d0ffe9d5dc83092e6de996483c4c08b439a316c0 (diff) | |
download | gcc-812798917c59e95405a71b31ab37bd78c0f43f79.zip gcc-812798917c59e95405a71b31ab37bd78c0f43f79.tar.gz gcc-812798917c59e95405a71b31ab37bd78c0f43f79.tar.bz2 |
c++: Allow subobject references in C++20.
The last new thing allowed by P1907R1: subobject addresses as template
arguments. The ABI group has discussed mangling for this; there has been
some talk of a compressed subobject mangling, but it hasn't been finalized,
so for now I'm using normal expression mangling. In order for two array
subobject references to compare as equal template arguments, the offsets
need to have the same type, so I convert them to always be the same type,
currently ptrdiff_t. Base class conversions are represented as a cast to
reference type, only if necessary to resolve an ambiguity.
This patch also updates the value of __cpp_nontype_template_args, since
the paper is fully implemented.
gcc/cp/ChangeLog:
* mangle.c (write_base_ref): New.
(write_expression): Use it for base field COMPONENT_REFs.
* pt.c (invalid_tparm_referent_p): Canonicalize the type
of array offsets. Allow subobjects.
gcc/c-family/ChangeLog:
* c-cppbuiltin.c (c_cpp_builtins): Update
__cpp_nontype_template_args for C++20.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/nontype2.C: No error in C++20.
* g++.dg/template/nontype25.C: No error in C++20.
* g++.dg/template/nontype8.C: No error in C++20.
* g++.dg/cpp2a/nontype-subob1.C: New test.
* g++.dg/cpp2a/nontype-subob2.C: New test.
* g++.dg/cpp1z/nontype3.C: Now C++17-only.
* g++.dg/cpp2a/feat-cxx2a.C: Adjust expected value.
Diffstat (limited to 'COPYING3')
0 files changed, 0 insertions, 0 deletions