1
# DP: Fix PR c++/53599 (reverting the fix for PR c++/53137)
3
--- a/src/gcc/cp/ChangeLog
4
+++ b/src/gcc/cp/ChangeLog
7
2012-06-01 Jason Merrill <jason@redhat.com>
10
- * pt.c (instantiate_class_template_1): Set LAMBDA_EXPR_THIS_CAPTURE.
11
- (instantiate_decl): Don't push_to_top_level for local class methods.
12
- (instantiate_class_template_1): Or for local classes.
15
* pt.c (do_auto_deduction): Don't try to deduce from a
16
type-dependent initializer.
22
unsigned int saved_maximum_field_alignment;
25
if (type == error_mark_node)
26
return error_mark_node;
29
push_deferring_access_checks (dk_no_deferred);
31
- fn_context = decl_function_context (TYPE_MAIN_DECL (type));
33
- push_to_top_level ();
34
+ push_to_top_level ();
35
/* Use #pragma pack from the template context. */
36
saved_maximum_field_alignment = maximum_field_alignment;
37
maximum_field_alignment = TYPE_PRECISION (pattern);
38
@@ -9194,14 +9191,8 @@
39
apply_lambda_return_type (lambda, void_type_node);
40
LAMBDA_EXPR_RETURN_TYPE (lambda) = NULL_TREE;
43
- LAMBDA_EXPR_THIS_CAPTURE (lambda)
44
- = lookup_field_1 (type, get_identifier ("__this"), false);
46
instantiate_decl (decl, false, false);
47
maybe_add_lambda_conv_op (type);
49
- LAMBDA_EXPR_THIS_CAPTURE (lambda) = NULL_TREE;
52
gcc_assert (errorcount);
54
perform_deferred_access_checks ();
56
maximum_field_alignment = saved_maximum_field_alignment;
58
- pop_from_top_level ();
59
+ pop_from_top_level ();
60
pop_deferring_access_checks ();
63
@@ -18466,10 +18456,9 @@
68
location_t saved_loc = input_location;
73
/* This function should only be used to instantiate templates for
74
functions and static member variables. */
75
@@ -18704,12 +18693,9 @@
79
- fn_context = decl_function_context (d);
80
- nested = (current_function_decl != NULL_TREE);
82
+ need_push = !cfun || !global_bindings_p ();
86
- push_function_context ();
88
/* Mark D as instantiated so that recursive calls to
89
instantiate_decl do not try to instantiate it again. */
90
@@ -18822,10 +18808,8 @@
91
/* We're not deferring instantiation any more. */
92
TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
96
pop_from_top_level ();
98
- pop_function_context ();
101
input_location = saved_loc;
102
--- a/src/gcc/testsuite/ChangeLog
103
+++ b/src/gcc/testsuite/ChangeLog
106
2012-06-01 Jason Merrill <jason@redhat.com>
109
- * g++.dg/cpp0x/lambda/lambda-template5.C: New.
111
-2012-06-01 Jason Merrill <jason@redhat.com>
114
* g++.dg/cpp0x/auto33.C: New.
116
--- a/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template5.C
117
+++ b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template5.C
120
-// { dg-do compile { target c++11 } }
124
- template <typename T> void f();
126
- template <typename T> void g()
128
- [this]{ f<T>(); }();