Clang AST - convert pointer to reference? [C++] - c++

I'm trying to store my methodDecl nodes in a map within RecursiveASTVisitor
std::map<std::string, ObjCMethodDecl> ObjCMethodsMap;
Currently I'm storing it like this
virtual bool HandleTopLevelDecl (DeclGroupRef DG) {
for (DeclGroupRef::iterator i = DG.begin(), e = DG.end(); i != e; ++i) {
Decl *D = *i;
if (ObjCMethodDecl *methodDecl = dyn_cast<ObjCMethodDecl>(D)) {
std::string methodName = methodDecl->getNameAsString();
ObjCMethodsMap[methodName] = ObjCMethodDecl(*methodDecl);
}
}
}
And when I'm trying to use it, I do this
ObjCMethodDecl methodDecl = ObjCMethodsMap["textFieldShouldReturn:"];
Visitor->TraverseDecl(&methodDecl);
This may be more of a C++ question, but am I doing anything wrongly in my way of storing it in reference?
Below is the compilation error message I'm getting. I'm not sure what does it say now because it is referencing to something not within my code and doesn't tell me which line it came from. That's why I thought maybe I did something wrong in C++
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1645:31: error: no matching constructor for initialization of 'clang::ObjCMethodDecl'
::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1572:18: note: in instantiation of function template specialization 'std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, clang::ObjCMethodDecl>, void *> >::construct<clang::ObjCMethodDecl>' requested here
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1453:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, clang::ObjCMethodDecl>, void *> > >::__construct<clang::ObjCMethodDecl>' requested here
{__construct(__has_construct<allocator_type, pointer, _Args...>(),
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1366:20: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, clang::ObjCMethodDecl>, void *> > >::construct<clang::ObjCMethodDecl>' requested here
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1380:29: note: in instantiation of member function 'std::__1::map<std::__1::basic_string<char>, clang::ObjCMethodDecl, std::__1::less<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, clang::ObjCMethodDecl> > >::__construct_node_with_key' requested here
__node_holder __h = __construct_node_with_key(__k);
^
/Users/jeremy/Desktop/clang-llvm/llvm/tools/clang/tools/extra/myASTChecker/MyASTChecker.cpp:272:55: note: in instantiation of member function 'std::__1::map<std::__1::basic_string<char>, clang::ObjCMethodDecl, std::__1::less<std::__1::basic_string<char> >, std::__1::allocator<std::__1::pair<const std::__1::basic_string<char>, clang::ObjCMethodDecl> > >::operator[]' requested here
ObjCMethodDecl methodDecl = ObjCMethodsMap[selectorName];
^
/Users/jeremy/Desktop/clang-llvm/llvm/tools/clang/include/clang/AST/DeclObjC.h:113:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
class ObjCMethodDecl : public NamedDecl, public DeclContext {
^
/Users/jeremy/Desktop/clang-llvm/llvm/tools/clang/include/clang/AST/DeclObjC.h:113:7: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided
/Users/jeremy/Desktop/clang-llvm/llvm/tools/clang/include/clang/AST/DeclObjC.h:226:3: note: candidate constructor not viable: requires at least 6 arguments, but 0 were provided
ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc,

Related

How to pass an object function as a template argument

bool HuffmanNode::Compare::operator()(const HuffmanNode &n1, const HuffmanNode &n2) const
{
if (n1.frequency == n2.frequency) {
return lessThan ? n1.character < n2.character : n1.character >= n2.character;
} else {
return lessThan ? n1.frequency < n2.frequency : n1.frequency >= n2.frequency;
}
}
bool HuffmanNode::Compare::operator()(const HuffmanNode *n1, const HuffmanNode *n2) const
{
return operator()(*n1, *n2);
}
Here I have a compare function from a compare object that is within another object (HuffmanNode).
I want to pass the compare function to another object through a template:
HeapQueue<HuffmanNode, HuffmanNode::Compare> queue;
This doesn't seem to work and I've even tried using the operator function.
What is the proper format for this? Thanks.
Here is my compiler error
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1826:31: error:
no matching constructor for initialization of 'HuffmanNode'
::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1718:18: note:
in instantiation of function template specialization
'std::__1::allocator<HuffmanNode>::construct<HuffmanNode>' requested here
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1561:14: note:
in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<HuffmanNode>
>::__construct<HuffmanNode>' requested here
{__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:1030:25: note:
in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<HuffmanNode>
>::construct<HuffmanNode>' requested here
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:1121:9: note:
in instantiation of member function 'std::__1::vector<HuffmanNode,
std::__1::allocator<HuffmanNode> >::__construct_at_end' requested here
__construct_at_end(__n);
^
./HeapQueue.hpp:25:26: note: in instantiation of member function
'std::__1::vector<HuffmanNode, std::__1::allocator<HuffmanNode> >::vector'
requested here
VectorCompleteTree() : V(1) {}
^
./HeapQueue.hpp:46:7: note: in instantiation of member function
'VectorCompleteTree<HuffmanNode>::VectorCompleteTree' requested here
class HeapQueue
^
./HuffmanBase.hpp:8:7: note: candidate constructor (the implicit copy
constructor) not viable: requires 1 argument, but 0 were provided
class HuffmanNode {
^
./HuffmanBase.hpp:8:7: note: candidate constructor (the implicit move
constructor) not viable: requires 1 argument, but 0 were provided
./HuffmanBase.hpp:11:3: note: candidate constructor not viable: requires 2
arguments, but 0 were provided
HuffmanNode(char c, size_t f) : HuffmanNode(c, f, nullptr, nullptr, nu...
^
./HuffmanBase.hpp:10:3: note: candidate constructor not viable: requires 5
arguments, but 0 were provided
HuffmanNode(char c, size_t f, HuffmanNode *p, HuffmanNode *l, HuffmanN...
^
1 error generated.
Starting from the bottom of the error message, the compiler is trying to do this HuffmanNode{} but failing because HuffmanNode doesn't have a default constructor. The key here is but 0 were provided.
./HuffmanBase.hpp:8:7: note: candidate constructor (the implicit copy
constructor) not viable: requires 1 argument, but 0 were provided
class HuffmanNode {
^
./HuffmanBase.hpp:8:7: note: candidate constructor (the implicit move
constructor) not viable: requires 1 argument, but 0 were provided
./HuffmanBase.hpp:11:3: note: candidate constructor not viable: requires 2
arguments, but 0 were provided
HuffmanNode(char c, size_t f) : HuffmanNode(c, f, nullptr, nullptr, nu...
^
./HuffmanBase.hpp:10:3: note: candidate constructor not viable: requires 5
arguments, but 0 were provided
HuffmanNode(char c, size_t f, HuffmanNode *p, HuffmanNode *l, HuffmanN...
^
The default constructor of HeapQueue is invoking the default constructor of VectorCompleteTree<HuffmanNode>.
./HeapQueue.hpp:46:7: note: in instantiation of member function
'VectorCompleteTree<HuffmanNode>::VectorCompleteTree' requested here
class HeapQueue
The default constructor of VectorCompleteTree<HuffmanNode> is constructing a std::vector<HuffmanNode> with one element. This one element needs to be default constructed.
./HeapQueue.hpp:25:26: note: in instantiation of member function
'std::__1::vector<HuffmanNode, std::__1::allocator<HuffmanNode> >::vector'
requested here
VectorCompleteTree() : V(1) {}
std::vector<HuffmanNode> is trying to default construct a HuffmanNode but can't.
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1826:31: error:
no matching constructor for initialization of 'HuffmanNode'
::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1718:18: note:
in instantiation of function template specialization
'std::__1::allocator<HuffmanNode>::construct<HuffmanNode>' requested here
{__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:1561:14: note:
in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<HuffmanNode>
>::__construct<HuffmanNode>' requested here
{__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:1030:25: note:
in instantiation of function template specialization
'std::__1::allocator_traits<std::__1::allocator<HuffmanNode>
>::construct<HuffmanNode>' requested here
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:1121:9: note:
in instantiation of member function 'std::__1::vector<HuffmanNode,
std::__1::allocator<HuffmanNode> >::__construct_at_end' requested here
__construct_at_end(__n);
It's all there in the error message! The simple solution would be do give HuffmanNode a default constructor.

How to use std::max with a custom comparator in C++11?

I have a vector of Hill structs and want to find the one with the heighest height. Here's my code:
#include <vector>
#include <algorithm>
#include <assert.h>
struct Hill {
int height;
int changed;
};
int main() {
std::vector<Hill> hills(100);
hills[0].height = 100;
hills[1].height = 150;
auto byHeight = [&](const Hill& a, const Hill& b) {
return a.height < b.height;
};
Hill hill = std::max(hills.begin(), hills.end(), byHeight);
assert(hill.height == 150);
}
But it fails to compile:
mcve.cpp:15:10: error: no viable conversion from 'const
std::__1::__wrap_iter<Hill *>' to 'Hill'
Hill hill = std::max(hills.begin(), hills.end(), byHeight);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mcve.cpp:4:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'const std::__1::__wrap_iter<Hill *>' to
'const Hill &' for 1st argument
struct Hill {
^
mcve.cpp:4:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'const std::__1::__wrap_iter<Hill *>' to
'Hill &&' for 1st argument
struct Hill {
^
In file included from mcve.cpp:1:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:270:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__bit_reference:15:
/Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:2627:12: error:
no matching function for call to object of type '(lambda at
mcve.cpp:12:21)'
return __comp(__a, __b) ? __b : __a;
^~~~~~
mcve.cpp:15:22: note: in instantiation of function template specialization
'std::__1::max<std::__1::__wrap_iter<Hill *>, (lambda at mcve.cpp:12:21)>'
requested here
Hill hill = std::max(hills.begin(), hills.end(), byHeight);
^
mcve.cpp:12:21: note: candidate function not viable: no known conversion from
'const std::__1::__wrap_iter<Hill *>' to 'const Hill' for 1st argument
auto byHeight = [&](const Hill& a, const Hill& b) {
^
2 errors generated.
How do I fix it?
Changing these two lines of code fixed the issue (thanks to #milleniumbug):
auto hill = std::max_element(hills.begin(), hills.end(), byHeight);
assert(hill->height == 150);
*std::max_element gets you the element itself. std::max_element returns an iterator, giving you an opportunity to modify the element.
Change std::max to *std::max_element and it'll work. With the *.
max_element() returns an iterator, which * dereferences to get the actual element.

Can no longer convert between std::unique_ptr<Derived> to std::unique_ptr<Base>

So I have an issue in converting between a base and derived class after adding some code to (de)serialize for JSON. I am using the nlohmann JSON library. For background, here is the general original set up (before the JSON code):
class Base;
class Derived : public Base;
std::unique_ptr<Derived> Foo(Node x) {
std::unique_ptr<Derived> result;
/* Set some fields */
return result;
}
std::unique_ptr<Base> NodeToBase(Node x) {
std::unique_ptr<Base> result = nullptr;
switch (x->type):
case (SomeType):
result = Foo(x);
return result;
}
Before adding the changes, the following assertions worked:
static_assert(std::is_convertible<Derived*, Base*>::value);
static_assert(std::is_convertible<std::unique_ptr<Derived>, std::unique_ptr<Base>>::value);
Next, I added some serialization functions to my base and derived classes as such:
class Base {
virtual nlohmann::json ToJson() const;
virtual void FromJson(const nlohmann::json &j);
}
class Derived : public Base {
nlohmann::json ToJson() const override;
void FromJson(const nlohmann::json &j) override;
}
I also removed any const quantifiers on member variables in Base and Derived to allow for deserialization.
And now, after compiling, the static_assert's above no longer worked, and I get the following error.
foo.cpp:155:14: error: no viable overloaded '='
result = Foo(x);
~~~~~~ ^ ~~~~~~~
/usr/local/Cellar/llvm#6/6.0.1/include/c++/v1/memory:2347:28: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'unique_ptr<Derived, default_delete<Derived>>' to 'const unique_ptr<Base, default_delete<Base>>' for 1st argument
class _LIBCPP_TEMPLATE_VIS unique_ptr {
^
/usr/local/Cellar/llvm#6/6.0.1/include/c++/v1/memory:2463:15: note: candidate function not viable: no known conversion from 'unique_ptr<Derived, default_delete<Derived>>' to 'unique_ptr<Base, default_delete<Base>>' for 1st argument
unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
^
/usr/local/Cellar/llvm#6/6.0.1/include/c++/v1/memory:2555:15: note: candidate function not viable: no known conversion from 'std::unique_ptr<Derived>' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
unique_ptr& operator=(nullptr_t) _NOEXCEPT {
^
/usr/local/Cellar/llvm#6/6.0.1/include/c++/v1/memory:2474:15: note: candidate template ignored: requirement 'is_convertible<typename unique_ptr<Derived, default_delete<Derived> >::pointer, pointer>::value' was not satisfied [with _Up = Derived, _Ep = std::__1::default_delete<Derived>]
unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
^
Any help would be appreciated. The only workaround I've found that works is to replace:
result = Foo(x);
with
result = std::unique_ptr<Base>(reinterpret_cast<Base *>(Foo(x).release()));

Multiple overloads of __compressed_pair error implementing unordered_set

I'm trying to implement an unordered_set in my bfs algorithm, but it gives me this errors:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2412:40:
error: multiple overloads
of '__compressed_pair' instantiate to the same signature 'void (_T2_param)' (aka 'void (int)')
_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:969:59:
note: in instantiation
of template class 'std::__1::__compressed_pair >' requested here
__compressed_pair __p2_;
^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_set:353:13:
note: in
instantiation of template class 'std::__1::__hash_table, std::__1::equal_to, std::__1::allocator
'
requested here
__table __table_;
^ AICharques.cc:47:21: note: in instantiation of template class 'std::__1::unordered_set,
std::__1::equal_to,
std::__1::allocator >' requested here
unordered_set visited;
^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2410:40:
note: previous declaration
is here
_LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
And this is my code:
void radar_bfs(Pos actualPos){
queue<Pos> frontier;
frontier.push(actualPos);
unordered_set<Pos> visited;
visited.insert(actualPos);
while(!frontier.empty()){
auto current = frontier.front();
frontier.pop();
for(auto next : neighbors(current)) {
if(not visited.count(next)){
frontier.push(next);
visited.insert(next);
}
}
}
}
Pos is a struct that contains two ints, i and j.(position in a board).
When i use just a set instead, the errors disappear.

cpprest/pplx : call to implicitly-deleted default constructor of '_ResultHolder<SomeObj>'

I am currently using the cpprest API found at https://casablanca.codeplex.com/ for a simple RESTful API project.
This popular library uses Microsoft's PPLX framework to facilitate the async tasks.
I am currently encountering an issue in which code does not compile when a function returns an object of type pplx::task<SomeObj> and SomeObj has no default constructor. My understanding is that this code should be a valid as no default objects should be created.
Is there an error in my code or is this a bug?
Example Code:
#include <vector>
#include <string>
#include <cpprest/http_client.h>
class SomeSubObj {
public:
int a,b,c;
SomeSubObj(int a, int b, int c): a(a), b(b), c(c){}
};
class SomeObj {
public:
std::vector<SomeSubObj> subObjs;
SomeObj(std::string json){
// Populate from JSON...
subObjs.push_back(SomeSubObj(1,1,1));
subObjs.push_back(SomeSubObj(2,2,2));
subObjs.push_back(SomeSubObj(3,3,3));
}
};
pplx::task<SomeObj> doSomething(){
return pplx::task<std::string>([]() {
// Make a call out and get some json...
return std::string("{...}");
}).then([](std::string x) {
// Return a transformed object
return SomeObj("...");
});
}
int main()
{
doSomething();
return 0;
}
I am currently receiving the following output:
g++ -std=c++0x -Iboost_thread-mt -Iboost_atomic -Iboost_system -Icpprest -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Bug.d" -MT"src/Bug.d" -o "src/Bug.o" "../src/Bug.cpp"
In file included from ../src/Bug.cpp:4:
In file included from /usr/local/include/cpprest/http_client.h:44:
/usr/local/include/pplx/pplxtasks.h:2404:9: error: call to implicitly-deleted default constructor of '_ResultHolder<SomeObj>'
_Task_impl(_CancellationTokenState * _Ct, scheduler_ptr _Scheduler_arg)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2096:15: note: in instantiation of member function 'pplx::details::_Task_impl<SomeObj>::_Task_impl' requested here
__second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2359:15: note: in instantiation of function template specialization 'std::__1::__libcpp_compressed_pair_imp<std::__1::allocator<pplx::details::_Task_impl<SomeObj> >, pplx::details::_Task_impl<SomeObj>, 1>::__libcpp_compressed_pair_imp<std::__1::allocator<pplx::details::_Task_impl<SomeObj> > &, pplx::details::_CancellationTokenState *&, pplx::scheduler_ptr &, 0, 0, 1>' requested here
: base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3697:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<pplx::details::_Task_impl<SomeObj> >, pplx::details::_Task_impl<SomeObj> >::__compressed_pair<std::__1::allocator<pplx::details::_Task_impl<SomeObj> > &, pplx::details::_CancellationTokenState *&, pplx::scheduler_ptr &>' requested here
: __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4271:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<pplx::details::_Task_impl<SomeObj>, std::__1::allocator<pplx::details::_Task_impl<SomeObj> > >::__shared_ptr_emplace<pplx::details::_CancellationTokenState *&, pplx::scheduler_ptr &>' requested here
::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4630:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<pplx::details::_Task_impl<SomeObj> >::make_shared<pplx::details::_CancellationTokenState *&, pplx::scheduler_ptr &>' requested here
return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
^
/usr/local/include/pplx/pplxtasks.h:1429:103: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
static _Type _Make(_CancellationTokenState * _Ct, scheduler_ptr _Scheduler_arg) { return std::make_shared<_Task_impl<_ReturnType>>(_Ct, _Scheduler_arg); }
^
/usr/local/include/pplx/pplxtasks.h:3623:52: note: in instantiation of member function 'pplx::details::_Task_ptr<SomeObj>::_Make' requested here
_M_Impl = details::_Task_ptr<_ReturnType>::_Make(_Ct, _Scheduler);
^
/usr/local/include/pplx/pplxtasks.h:4138:27: note: in instantiation of member function 'pplx::task<SomeObj>::_CreateImpl' requested here
_ContinuationTask._CreateImpl(_PTokenState, _Scheduler);
^
/usr/local/include/pplx/pplxtasks.h:4101:16: note: in instantiation of function template specialization 'pplx::task<std::__1::basic_string<char> >::_ThenImpl<std::__1::basic_string<char>, <lambda at ../src/Bug.cpp:27:10> >' requested here
return _ThenImpl<_InternalReturnType, _Function>(_Func, _PTokenState, _TaskOptions.get_continuation_context(), _Scheduler, _CreationStack);
^
/usr/local/include/pplx/pplxtasks.h:3424:16: note: in instantiation of function template specialization 'pplx::task<std::__1::basic_string<char> >::_ThenImpl<std::__1::basic_string<char>, <lambda at ../src/Bug.cpp:27:10> >' requested here
return _ThenImpl<_ReturnType, _Function>(_Func, _TaskOptions);
^
../src/Bug.cpp:27:5: note: in instantiation of function template specialization 'pplx::task<std::__1::basic_string<char> >::then<<lambda at ../src/Bug.cpp:27:10> >' requested here
}).then([](std::string x) {
^
/usr/local/include/pplx/pplxtasks.h:844:15: note: default constructor of '_ResultHolder<SomeObj>' is implicitly deleted because field '_Result' has no default constructor
_Type _Result;
^
1 error generated.
make: *** [src/Bug.o] Error 1