c++: Allow floating-point template parms in C++20.
authorJason Merrill <jason@redhat.com>
Thu, 2 Jul 2020 19:14:52 +0000 (15:14 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 10 Jul 2020 12:36:50 +0000 (08:36 -0400)
commit50f071d999374b6dd13149a31f505d4457c9de6d
tree1885dd7dce23a0a290a08ea85c2e9f593c83d513
parente47dfca5aa473e77fdff95d631dc39de87a41eec
c++: Allow floating-point template parms in C++20.

P1907R1 made various adjustments to non-type template parameters, notably
introducing the notion of "structural type".  I implemented an early version
of that specification in r10-4426, but it was adjusted in the final paper to
allow more.  This patch implements allowing template parameters of
floating-point type; still to be implemented are unions and subobjects.

gcc/cp/ChangeLog:

* pt.c (convert_nontype_argument): Handle REAL_TYPE.
(invalid_nontype_parm_type_p): Allow all structural types.
* tree.c (structural_type_p): Use SCALAR_TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/pr81246.C: No error in C++20.
* g++.dg/cpp0x/variadic74.C: No error in C++20.
* g++.dg/cpp1z/nontype-auto3.C: No error in C++20.
* g++.dg/template/crash106.C: No error in C++20.
* g++.dg/template/crash119.C: No error in C++20.
* g++.dg/template/nontype12.C: No error in C++20.
* g++.dg/template/void3.C: Don't require follow-on message.
* g++.dg/template/void7.C: Don't require follow-on message.
* g++.dg/template/void9.C: Don't require follow-on message.
12 files changed:
gcc/cp/pt.c
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/pr81246.C
gcc/testsuite/g++.dg/cpp0x/variadic74.C
gcc/testsuite/g++.dg/cpp1z/nontype-auto3.C
gcc/testsuite/g++.dg/cpp2a/nontype-class-equiv1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/crash106.C
gcc/testsuite/g++.dg/template/crash119.C
gcc/testsuite/g++.dg/template/nontype12.C
gcc/testsuite/g++.dg/template/void3.C
gcc/testsuite/g++.dg/template/void7.C
gcc/testsuite/g++.dg/template/void9.C