Bug 56447 - [C++11] Lambda in template has conversion op it shouldn't have
Summary: [C++11] Lambda in template has conversion op it shouldn't have
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.1
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, c++-lambda
: 54995 (view as bug list)
Depends on:
Blocks: lambdas
  Show dependency treegraph
 
Reported: 2013-02-25 20:00 UTC by Jason Merrill
Modified: 2022-03-11 00:32 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-02-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Merrill 2013-02-25 20:00:57 UTC
template <class T>
void f()
{
  int i;
  // This lambda should not have a conversion op, since it captures i
  int (*p)() = [=]{ return i; }; // { dg-error "cannot convert" }
}
Comment 1 Jason Merrill 2013-03-04 18:10:40 UTC
*** Bug 54995 has been marked as a duplicate of this bug. ***
Comment 2 Jason Merrill 2013-03-17 02:35:34 UTC
Author: jason
Date: Sun Mar 17 02:35:18 2013
New Revision: 196729

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196729
Log:
	PR c++/56447
	PR c++/55532
	* pt.c (instantiate_class_template_1): Instantiate lambda capture
	list here.
	(tsubst_copy_and_build): Not here.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv8.C
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
Comment 3 Jason Merrill 2013-03-23 19:00:21 UTC
Fixed for 4.8.1.