Skip to content

q::all exampe in tutorial not compiling on clang 9.0.0 mac os #22

@deblauwetom

Description

@deblauwetom

Hi, my clang version is:

clang++ --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

And so I'm trying to compile this example:

// This is basically a list of promises of floats
std::vector< q::promise< float > > list;

q:all( list, queue )
.then( [ ]( std::vector< q::expect< float > >&& values )
{
	// Now all promises have settled (i.e. are not waiting anymore),
	// but some of them might have failed.
	for ( auto& val : values )
	{
		if ( val.has_exception( ) )
			std::cout << "Failure: " << val.exception( ) << std::endl;
		else
			std::cout << "Value: " << val.get( ) << std::endl;
	}
} );

But first i think the "q:all" should have double colons in the example? But it doesn't complain about it for some reason :) anyway. Also, writing val.exception() to std::cout is not working for me, also gives a compile error.
So the first main error I get is:

error: no matching function for call to 'all'
    q::all( list, qq )
    ^~~~~~

I can only fix it by using a move:

q::all( std::move(list), qq )

So then the next error I get is:

6: error: no matching member function for call to 'then'
    .then( [ ]( std::vector< q::expect< float > >&& values )
    ~^~~~
    ....

The rest of the errors list then states what he tries to do, but I don't know what signature it is supposed to be:

/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:177:3: note: candidate template ignored: disabled by 'enable_if' [with Fn = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12), Queue = std::__1::shared_ptr<q::queue>]
                is_function_t< Fn >::value
                ^
/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:197:3: note: candidate template ignored: disabled by 'enable_if' [with Fn = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12), Queue = std::__1::shared_ptr<q::queue>]
                is_function_t< Fn >::value
                ^
/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:231:2: note: candidate template ignored: substitution failure [with Fn = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12), Queue = std::__1::shared_ptr<q::queue>]: type 'result_of_t<(lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12)>' (aka 'void') cannot be used prior to '::' because it has no members
        then( Fn&& fn, Queue&& queue = nullptr );
        ^
/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:252:2: note: candidate template ignored: substitution failure [with Fn = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12), Queue = std::__1::shared_ptr<q::queue>]: type 'result_of_t<(lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12)>' (aka 'void') cannot be used prior to '::' because it has no members
        then( Fn&& fn, Queue&& queue = nullptr );
        ^
/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:256:3: note: candidate template ignored: disabled by 'enable_if' [with Logger = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12), Queue = std::__1::shared_ptr<q::queue>]
                is_same_type< Logger, log_chain_generator >::value
                ^
/Users/tom/.conan/data/libq/0.0.1/metalmajor/testing/package/f331ba4cb4cf3b345ec2ebc265629b6ee1340312/include/q/promise/promise.hpp:272:3: note: candidate template ignored: disabled by 'enable_if' [with AsyncTask = (lambda at /Users/tom/projects/BackendCommunication/BackendDispatcherImpl.cpp:136:12)]
                is_same_type< AsyncTask, async_task >::value,

Is it a clang issue on mac os or is something wrong with the example?
ps: as you can see from the compiler output, I am busy making a conan package file for libq too, so if you would be interested, it would be cool to have it in the repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions