This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50863] New: [4.7 Regression] [C++0x] list-initialization with lambda fails to deduce constructor argument
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Oct 2011 12:25:27 +0000
- Subject: [Bug c++/50863] New: [4.7 Regression] [C++0x] list-initialization with lambda fails to deduce constructor argument
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50863
Bug #: 50863
Summary: [4.7 Regression] [C++0x] list-initialization with
lambda fails to deduce constructor argument
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
CC: jason@gcc.gnu.org
struct T {
template<typename F>
T(F) { }
};
int main()
{
T t{ []{ } };
}
this compiles ok with 4.6 but barfs with 4.7.0 20111015
t.cc: In function 'int main()':
t.cc:8:11: error: expected primary-expression before ']' token
t.cc:8:13: error: expected '=' before '{' token
t.cc:8:17: error: deducing from brace-enclosed initializer list requires
#include <initializer_list>
t.cc:8:17: error: no matching function for call to 'T::T(<brace-enclosed
initializer list>)'
t.cc:8:17: note: candidates are:
t.cc:3:9: note: template<class F> T::T(F)
t.cc:3:9: note: substitution of deduced template arguments resulted in errors
seen above
t.cc:1:8: note: constexpr T::T(const T&)
t.cc:1:8: note: no known conversion for argument 1 from '<brace-enclosed
initializer list>' to 'const T&'
t.cc:1:8: note: constexpr T::T(T&&)
t.cc:1:8: note: no known conversion for argument 1 from '<brace-enclosed
initializer list>' to 'T&&'
this prevents list-initialization of std::thread with a lambda:
std::thread t{ []{ } };