Commit d9fac9dd by Jason Merrill Committed by Jason Merrill

re PR c++/57526 (use of X before deduction of auto error for seemingly good code)

	PR c++/57526
	* semantics.c (lambda_capture_field_type): Build a DECLTYPE_TYPE
	if the variable type uses 'auto'.

From-SVN: r200844
parent f9f91ddc
2013-07-09 Jason Merrill <jason@redhat.com>
PR c++/57526
* semantics.c (lambda_capture_field_type): Build a DECLTYPE_TYPE
if the variable type uses 'auto'.
PR c++/57437
* typeck.c (check_return_expr): Lambda proxies aren't eligible
for nrv or return by move.
......
......@@ -9177,7 +9177,7 @@ lambda_capture_field_type (tree expr, bool explicit_init_p)
}
else
type = non_reference (unlowered_expr_type (expr));
if (!type || WILDCARD_TYPE_P (type))
if (!type || WILDCARD_TYPE_P (type) || type_uses_auto (type))
{
type = cxx_make_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
......
// PR c++/57526
// { dg-require-effective-target c++11 }
template<class T>
struct A
{
void bar( ) { }
void foo( )
{
auto* this_ptr = this;
auto lc = [&]( )
{
this_ptr->bar();
};
lc();
}
};
int main()
{
A<int> a;
a.foo();
}
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