Commit 892562cf by Jason Merrill Committed by Jason Merrill

re PR c++/65843 (multiple use of const variable in lamba in template function causes compile error)

	PR c++/65843
	* pt.c (tsubst_copy_and_build): Register a capture proxy in
	local_specializations.

From-SVN: r224676
parent 2e562987
2015-06-19 Jason Merrill <jason@redhat.com>
PR c++/65843
* pt.c (tsubst_copy_and_build): Register a capture proxy in
local_specializations.
2015-06-17 Jason Merrill <jason@redhat.com>
PR c++/66001
......
......@@ -15665,7 +15665,11 @@ tsubst_copy_and_build (tree t,
r = build_cxx_call (wrap, 0, NULL, tf_warning_or_error);
}
else if (outer_automatic_var_p (r))
r = process_outer_var_ref (r, complain);
{
r = process_outer_var_ref (r, complain);
if (is_capture_proxy (r))
register_local_specialization (r, t);
}
if (TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
/* If the original type was a reference, we'll be wrapped in
......
// PR c++/65843
// { dg-do compile { target c++11 } }
template<class T>
void test(T b)
{
const int a = b;
[&] () { return a, a; }();
}
int main() {
test(1);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment