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: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org
                CC: ja...@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{ []{ } };

Reply via email to