Bug 74098

Summary: [clover] adaptor.hpp:47:16: error: function cannot return function type 'std::vector<unsigned long, std::allocator<unsigned long> > (unsigned long, unsigned long)'
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: mesa-dev
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: chad.harris
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: http://llvm.org/bugs/show_bug.cgi?id=18645
Whiteboard:
i915 platform: i915 features:
Attachments: clover_workaround_clang_function_argument_deduction.patch

Description Vinson Lee 2014-01-27 00:52:10 UTC
mesa: 07149f0252c52b4ac58b6df4e307fd786b49b490 (master)

clang build error

  CXX      core/libclover_la-kernel.lo
In file included from core/kernel.cpp:23:
In file included from ./core/kernel.hpp:28:
In file included from ./core/object.hpp:33:
In file included from ./core/property.hpp:28:
In file included from ./util/range.hpp:29:
./util/adaptor.hpp:47:16: error: function cannot return function type 'std::vector<unsigned long, std::allocator<unsigned long> > (unsigned long, unsigned long)'
               F(typename std::iterator_traits<Is>::reference...)
               ^
Comment 1 Tom Stellard 2014-01-27 13:52:20 UTC
Which version of clang were you using?
Comment 2 Vinson Lee 2014-01-27 18:56:51 UTC
(In reply to comment #1)
> Which version of clang were you using?

$ clang++ --version
Ubuntu clang version 3.4-1ubuntu2 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
Comment 3 Francisco Jerez 2014-01-28 15:32:41 UTC
Created attachment 92932 [details] [review]
clover_workaround_clang_function_argument_deduction.patch

I suspect this is a clang bug.  In the function call to "map(F &&f, ...)" in "util/factor.hpp:115" it deduces the template argument "F" as a function type instead of an lvalue-reference to function type, as it should be because the provided argument is an lvalue.

Would you mind bringing this to the LLVM bug tracker?  For the meantime you can use the attached work-around to get it to build with clang.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.