diff options
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r-- | gcc/cp/lambda.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 978fa0d..d511185 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -154,6 +154,11 @@ begin_lambda_type (tree lambda) LAMBDA_EXPR_CLOSURE (lambda) = type; CLASSTYPE_LAMBDA_EXPR (type) = lambda; + /* In C++17, assume the closure is literal; we'll clear the flag later if + necessary. */ + if (cxx_dialect >= cxx1z) + CLASSTYPE_LITERAL_P (type) = true; + /* Clear base types. */ xref_basetypes (type, /*bases=*/NULL_TREE); @@ -1004,6 +1009,7 @@ maybe_add_lambda_conv_op (tree type) direct_argvec->address ()); CALL_FROM_THUNK_P (call) = 1; + SET_EXPR_LOCATION (call, UNKNOWN_LOCATION); tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN (callop)); stattype = (cp_build_type_attribute_variant @@ -1141,6 +1147,18 @@ maybe_add_lambda_conv_op (tree type) --function_depth; } +/* True if FN is the static function "_FUN" that gets returned from the lambda + conversion operator. */ + +bool +lambda_static_thunk_p (tree fn) +{ + return (fn && TREE_CODE (fn) == FUNCTION_DECL + && DECL_ARTIFICIAL (fn) + && DECL_STATIC_FUNCTION_P (fn) + && LAMBDA_TYPE_P (CP_DECL_CONTEXT (fn))); +} + /* Returns true iff VAL is a lambda-related declaration which should be ignored by unqualified lookup. */ |