]> gcc.gnu.org Git - gcc.git/commit
Implement C++17 constexpr lambda.
authorJason Merrill <jason@redhat.com>
Tue, 9 Aug 2016 04:33:58 +0000 (00:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 9 Aug 2016 04:33:58 +0000 (00:33 -0400)
commit98e5a19af592e5329ae7d991ad8d9e9b7b81be37
treec6df51387a49c0bebc8f02921379e3e80cdba861
parent7dc2b4a235481acda5ae9e51f4cc0401b1fb192f
Implement C++17 constexpr lambda.

gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_constexpr for
C++17 constexpr lambdas.
gcc/cp/
* class.c (finalize_literal_type_property): Handle lambdas.
* constexpr.c (is_valid_constexpr_fn): Likewise.  No longer static.
(explain_invalid_constexpr_fn, cxx_eval_call_expression): Handle
lambdas.
(cxx_eval_constant_expression): Handle capture proxy.
(var_in_constexpr_fn): Don't check for C++14.
(var_in_maybe_constexpr_fn): New.
(potential_constant_expression_1): Use it.  Check DECL_EXPR for
declarations not allowed in constexpr function.
* decl.c (make_rtl_for_nonlocal_decl): Use var_in_maybe_constexpr_fn.
(finish_function): Set DECL_DECLARED_CONSTEXPR_P on lambda members.
* lambda.c (begin_lambda_type): Set CLASSTYPE_LITERAL_P.
(maybe_add_lambda_conv_op): Clear thunk CALL_EXPR location.
(lambda_static_thunk_p): New.
* parser.c (cp_keyword_starts_decl_specifier_p): Add RID_CONSTEXPR.
(CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): New enumerator.
(cp_parser_decl_specifier_seq): Handle it.
(cp_parser_lambda_declarator_opt): Use cp_parser_decl_specifier_seq.
* pt.c (instantiate_class_template_1): Set CLASSTYPE_LITERAL_P.
(tsubst_copy_and_build) [CALL_EXPR]: Propagate CALL_FROM_THUNK_P.
* error.c (dump_function_decl): Check TFF_NO_TEMPLATE_BINDINGS.
(dump_expr) [FUNCTION_DECL]: Pass it.

From-SVN: r239268
29 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/lambda.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv.C
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle.C
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle4.C
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda13.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda14.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda9.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
This page took 0.063566 seconds and 5 git commands to generate.