re PR c++/55710 ([C++11] Linkage errors with lambdas)
PR c++/55710 * semantics.c (maybe_add_lambda_conv_op): Mark static thunk TREE_USED. From-SVN: r196025
This commit is contained in:
parent
70fc7c6c3d
commit
43c2d791b4
@ -1,5 +1,9 @@
|
||||
2013-02-13 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55710
|
||||
* semantics.c (maybe_add_lambda_conv_op): Mark static thunk
|
||||
TREE_USED.
|
||||
|
||||
PR c++/55879
|
||||
* semantics.c (cxx_bind_parameters_in_call): Undo DECL_BY_REFERENCE.
|
||||
|
||||
|
@ -9559,6 +9559,8 @@ maybe_add_lambda_conv_op (tree type)
|
||||
body = begin_function_body ();
|
||||
compound_stmt = begin_compound_stmt (0);
|
||||
|
||||
/* decl_needed_p needs to see that it's used. */
|
||||
TREE_USED (statfn) = 1;
|
||||
finish_return_stmt (decay_conversion (statfn, tf_warning_or_error));
|
||||
|
||||
finish_compound_stmt (compound_stmt);
|
||||
|
20
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv7.C
Normal file
20
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv7.C
Normal file
@ -0,0 +1,20 @@
|
||||
// PR c++/55710
|
||||
// { dg-do link { target c++11 } }
|
||||
|
||||
template <class T>
|
||||
struct X {
|
||||
static void (*code) ();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void (*X<T>::code) () = []{}; // Line 7
|
||||
|
||||
struct Y {
|
||||
void (*code) () = []{} ; // Line 10
|
||||
void operator()() { code(); }
|
||||
};
|
||||
|
||||
int main () {
|
||||
X<int>::code();
|
||||
Y()();
|
||||
}
|
Loading…
Reference in New Issue
Block a user