Implement P0732R2, class types in non-type template parameters.
commit95f798aaef2811084001881f5af6c978561174cf
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Nov 2018 07:47:02 +0000 (5 07:47 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Nov 2018 07:47:02 +0000 (5 07:47 +0000)
tree074d1e84a17c188274a39b3a002dc5c265626a8e
parent59183fff1829ab6b4db926e381a73cd3da26225f
Implement P0732R2, class types in non-type template parameters.

There is one significant piece of this that is not implemented yet: the
reliance on defaulted operator<=>, which someone else has been working on.
So, for the moment those lines are commented out of the testcases.

One tricky bit was treating template parameters of classtype as const
lvalues without making their decltype const; for this I used a
VIEW_CONVERT_EXPR wrapper, which previously could only appear in templates
as location wrappers.

The user-defined literal parts of P0732R2 are in the next patch.

gcc/cp/
* error.c (dump_simple_decl): Look through a template parm object.
* mangle.c (write_template_arg): Likewise.
(mangle_template_parm_object): New.
* pt.c (template_parm_object_p, get_template_parm_object): New.
(invalid_tparm_referent_p): Factor from convert_nontype_argument.
(convert_nontype_argument, invalid_nontype_parm_type_p): Handle
class-type template arguments.
* tree.c (lvalue_kind): Likewise.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Add
__cpp_nontype_template_parameter_class.
libiberty/
* cp-demangle.c (d_dump, d_make_comp, d_count_templates_scopes)
(d_print_comp_inner): Handle DEMANGLE_COMPONENT_TPARM_OBJ.
(d_special_name): Handle TA.
(d_expresion_1): Fix demangling of brace-enclosed initializer list.
include/
* demangle.h (enum demangle_component_type): Add
DEMANGLE_COMPONENT_TPARM_OBJ.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265789 138bc75d-0d04-0410-961f-82ee72b054a4
27 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/error.c
gcc/cp/mangle.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
gcc/testsuite/g++.dg/cpp2a/nontype-class1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/crash55.C
gcc/testsuite/g++.dg/template/nontype16.C
gcc/testsuite/g++.dg/template/nontype4.C
gcc/testsuite/g++.dg/template/nontype5.C
gcc/testsuite/g++.dg/template/operator10.C
include/ChangeLog
include/demangle.h
libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected