I recently tried to leetcode test locally using --local. I ran into an error when doing so, and traced the error to the std::decay datatype of the input and output objects. It appears that line 58 of the plugin is not extracting the type correctly (should be std::decay< vector<int> > but is std::decay<>). Manually changing to std::decay< vector<int> > allows .tmp.cpp.run.cpp to be compiled and run correctly.
[ERROR] .tmp.cpp.run.cpp: In function ‘int main()’:
[ERROR] .tmp.cpp.run.cpp:252:9: error: wrong number of template arguments (0, should be 1)
[ERROR] decay<>::type p0 = {3,9,20,15,7};
[ERROR] ^
[ERROR] In file included from /usr/include/c++/7/bits/move.h:54:0,
[ERROR] from /usr/include/c++/7/bits/stl_pair.h:59,
[ERROR] from /usr/include/c++/7/utility:70,
[ERROR] from /usr/include/c++/7/algorithm:60,
[ERROR] from .tmp.cpp.run.cpp:2:
[ERROR] /usr/include/c++/7/type_traits:2116:11: note: provided for ‘template<class _Tp> class std::decay’
[ERROR] class decay
[ERROR] ^~~~~
[ERROR] .tmp.cpp.run.cpp:252:17: error: expected initializer before ‘p0’
[ERROR] decay<>::type p0 = {3,9,20,15,7};
[ERROR] ^~
[ERROR] .tmp.cpp.run.cpp:253:9: error: wrong number of template arguments (0, should be 1)
[ERROR] decay<>::type p1 = {9,3,15,20,7};
[ERROR] ^
[ERROR] In file included from /usr/include/c++/7/bits/move.h:54:0,
[ERROR] from /usr/include/c++/7/bits/stl_pair.h:59,
[ERROR] from /usr/include/c++/7/utility:70,
[ERROR] from /usr/include/c++/7/algorithm:60,
[ERROR] from .tmp.cpp.run.cpp:2:
[ERROR] /usr/include/c++/7/type_traits:2116:11: note: provided for ‘template<class _Tp> class std::decay’
[ERROR] class decay
[ERROR] ^~~~~
[ERROR] .tmp.cpp.run.cpp:253:17: error: expected initializer before ‘p1’
[ERROR] decay<>::type p1 = {9,3,15,20,7};
[ERROR] ^~
[ERROR] .tmp.cpp.run.cpp:254:26: error: ‘p0’ was not declared in this scope
[ERROR] auto res = s.buildTree(p0,p1);
[ERROR] ^~
[ERROR] .tmp.cpp.run.cpp:254:26: note: suggested alternative: ‘y0’
[ERROR] auto res = s.buildTree(p0,p1);
[ERROR] ^~
[ERROR] y0
[ERROR] .tmp.cpp.run.cpp:254:29: error: ‘p1’ was not declared in this scope
[ERROR] auto res = s.buildTree(p0,p1);
[ERROR] ^~
[ERROR] .tmp.cpp.run.cpp:254:29: note: suggested alternative: ‘y1’
[ERROR] auto res = s.buildTree(p0,p1);
[ERROR] ^~
[ERROR] y1
How to reproduce
leetcode test 105.construct-binary-tree-from-preorder-and-inorder-traversal.cpp --local
Problem Summary
I recently tried to datatype of the input and output objects. It appears that line 58 of the plugin is not extracting the type correctly (should be
leetcode test
locally using--local
. I ran into an error when doing so, and traced the error to the std::decaystd::decay< vector<int> >
but isstd::decay<>
). Manually changing tostd::decay< vector<int> >
allows .tmp.cpp.run.cpp to be compiled and run correctly.How to reproduce
leetcode test 105.construct-binary-tree-from-preorder-and-inorder-traversal.cpp --local
Relevant files .tmp.cpp.run.cpp 105.construct-binary-tree-from-preorder-and-inorder-traversal.cpp
Environment