Public bug reported:

In clang 3.3-5ubuntu4, I compiled attached source, and failed to compile.
Clang failed to solve an overloaded constructor in a lambda function which 
captures variables by copy.

Error messages are as follow:
test.cc:12:24: error: no matching constructor for initialization of 
'std::vector<int>'
      [=] { return sum(std::vector<int>(a.begin(), middle)); });
                       ^                ~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:269:7:
 note: candidate constructor not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const_pointer, std::vector<int, 
std::allocator<int> > >') to 'size_type' (aka 'unsigned long') for 1st
      argument
      vector(size_type __n, const allocator_type& __a = allocator_type())
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:281:7:
 note: candidate constructor not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const_pointer, std::vector<int, 
std::allocator<int> > >') to 'size_type' (aka 'unsigned long') for 1st
      argument
      vector(size_type __n, const value_type& __value,
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:331:7:
 note: candidate constructor not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const_pointer, std::vector<int, 
std::allocator<int> > >') to
      'const std::vector<int, std::allocator<int> >' for 1st argument
      vector(const vector& __x, const allocator_type& __a)
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:340:7:
 note: candidate constructor not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const_pointer, std::vector<int, 
std::allocator<int> > >') to 'std::vector<int, std::allocator<int> >'
      for 1st argument
      vector(vector&& __rv, const allocator_type& __m)
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:364:7:
 note: candidate constructor not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const_pointer, std::vector<int, 
std::allocator<int> > >') to 'initializer_list<value_type>' for 1st
      argument
      vector(initializer_list<value_type> __l,
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:392:9:
 note: candidate template ignored: deduced conflicting types for
      parameter '_InputIterator' ('__normal_iterator<const int *, [...]>' vs. 
'__normal_iterator<int *, [...]>')
        vector(_InputIterator __first, _InputIterator __last,
        ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:248:7:
 note: candidate constructor not viable: requires 0 arguments,
      but 2 were provided
      vector()
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:256:7:
 note: candidate constructor not viable: requires single argument
      '__a', but 2 arguments were provided
      vector(const allocator_type& __a)
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:310:7:
 note: candidate constructor not viable: requires single argument
      '__x', but 2 arguments were provided
      vector(const vector& __x)
      ^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:327:7:
 note: candidate constructor not viable: requires single argument
      '__x', but 2 arguments were provided
      vector(vector&& __x) noexcept
      ^
1 error generated.

** Affects: clang (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "source"
   https://bugs.launchpad.net/bugs/1283710/+attachment/3992700/+files/test.cc

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1283710

Title:
  Failed to solve an overloaded constructor in a lambda function

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/clang/+bug/1283710/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to