jamboree / bustache

C++20 implementation of {{ mustache }}
82 stars 10 forks source link

Cannot compile with Apple LLVM version 9.1.0 (clang-902.0.39.1) #9

Closed Accessory closed 6 years ago

Accessory commented 6 years ago

I failed to compile the code under MacOS with the following configuration:

cmake version: 3.11.0,

clang --version: Apple LLVM version 9.1.0 (clang-902.0.39.1) Target: x86_64-apple-darwin17.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

boost version: 1.66

Building Output:

`[ 66%] Building CXX object CMakeFiles/bustache.dir/src/format.cpp.o [ 66%] Building CXX object CMakeFiles/bustache.dir/src/generate.cpp.o In file included from /Users/build/bustache-master/src/generate.cpp:8: In file included from /Users/build/bustache-master/include/bustache/generate.hpp:10: In file included from /Users/build/bustache-master/include/bustache/model.hpp:10: In file included from /Users/build/bustache-master/include/bustache/format.hpp:10: In file included from /Users/build/bustache-master/include/bustache/ast.hpp:10: In file included from /Users/build/bustache-master/include/bustache/detail/variant.hpp:12: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:198: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/tuple:16: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4323:23: error: calling 'operator()' with incomplete return type 'bustache::value' _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(f)(_VSTD::forward<_Args>(__args)...))


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4220:23: note: expanded from macro '_LIBCPP_INVOKE_RETURN'
    noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \
                      ^~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4340:9: note: in instantiation of exception specification for '__invoke<std::__1::function<bustache::value ()> &>' requested here
        _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1601:33: note: in instantiation of template class 'std::__1::__invokable_r<void, std::__1::function<bustache::value ()> &>' requested here
                                __invokable<_Fp&, _ArgTypes...>::value>
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1626:9: note: in instantiation of default argument for '__callable<std::__1::function<bustache::value ()> >' required here
        __callable<_Fp>::value && !is_same<_Fp, function>::value
        ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1628:5: note: in instantiation of default argument for 'function<std::__1::function<bustache::value ()> >' required here
    function(_Fp);
    ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1588:28: note: while substituting deduced template arguments into function template 'function' [with _Fp = std::__1::function<bustache::value ()>, $1 = (no value)]
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1680:9: note: 'operator()' declared here
    _Rp operator()(_ArgTypes...) const;
        ^
/Users/build/bustache-master/include/bustache/model.hpp:56:11: note: definition of 'bustache::value' is not complete until the closing '}'
    class value : public variant_base<value>
          ^
In file included from /Users/build/bustache-master/src/generate.cpp:8:
In file included from /Users/build/bustache-master/include/bustache/generate.hpp:10:
In file included from /Users/build/bustache-master/include/bustache/model.hpp:10:
In file included from /Users/build/bustache-master/include/bustache/format.hpp:10:
In file included from /Users/build/bustache-master/include/bustache/ast.hpp:10:
In file included from /Users/build/bustache-master/include/bustache/detail/variant.hpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:198:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:16:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4323:23: error: calling 'operator()' with incomplete return type 'bustache::value'
_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4220:23: note: expanded from macro '_LIBCPP_INVOKE_RETURN'
    noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \
                      ^~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4340:9: note: in instantiation of exception specification for '__invoke<std::__1::function<bustache::value (const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &)> &, const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &>' requested here
        _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1601:33: note: in instantiation of template class 'std::__1::__invokable_r<void, std::__1::function<bustache::value (const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &)> &, const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &>' requested here
                                __invokable<_Fp&, _ArgTypes...>::value>
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1626:9: note: in instantiation of default argument for '__callable<std::__1::function<bustache::value (const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &)> >' required here
        __callable<_Fp>::value && !is_same<_Fp, function>::value
        ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1628:5: note: in instantiation of default argument for 'function<std::__1::function<bustache::value (const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &)> >' required here
    function(_Fp);
    ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1588:28: note: while substituting deduced template arguments into function template 'function' [with _Fp = std::__1::function<bustache::value (const std::__1::vector<bustache::ast::content, std::__1::allocator<bustache::ast::content> > &)>, $1 = (no value)]
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1680:9: note: 'operator()' declared here
    _Rp operator()(_ArgTypes...) const;
        ^
/Users/build/bustache-master/include/bustache/model.hpp:56:11: note: definition of 'bustache::value' is not complete until the closing '}'
    class value : public variant_base<value>
          ^
2 errors generated.
make[3]: *** [CMakeFiles/bustache.dir/src/generate.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/bustache.dir/all] Error 2
make[1]: *** [CMakeFiles/bustache.dir/rule] Error 2
make: *** [bustache] Error 2`
jamboree commented 6 years ago

That seems to be a strange problem in your toolchain. Unfortunately I don't have MacOS to test for it. The error message seems to indicate that your compiler/stdlib wrongly requires the type to be complete in std::function. Out of curiosity, does the code below compiles for you?

struct S {
    std::function<S()> f;
};
Accessory commented 6 years ago

It does not compile.

`In file included from /Users/build/main.cpp:1: In file included from /Users/build/main.h:3: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:169: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:56: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4323:23: error: calling 'operator()' with incomplete return type 'S' _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(f)(_VSTD::forward<_Args>(__args)...))


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4220:23: note: expanded from macro '_LIBCPP_INVOKE_RETURN'
    noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__) \
                      ^~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4340:9: note: in instantiation of exception specification for '__invoke<std::__1::function<S ()> &>' requested here
        _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...));
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:441:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1601:33: note: in instantiation of template class 'std::__1::__invokable_r<void, std::__1::function<S ()> &>' requested here
                                __invokable<_Fp&, _ArgTypes...>::value>
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1626:9: note: in instantiation of default argument for '__callable<std::__1::function<S ()> >' required here
        __callable<_Fp>::value && !is_same<_Fp, function>::value
        ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1628:5: note: in instantiation of default argument for 'function<std::__1::function<S ()> >' required here
    function(_Fp);
    ^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1588:28: note: while substituting deduced template arguments into function template 'function' [with _Fp = std::__1::function<S ()>, $1 = (no value)]
class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
                           ^
/Users/build/main.cpp:13:8: note: while declaring the implicit move constructor for 'S'
struct S {
       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1680:9: note: 'operator()' declared here
    _Rp operator()(_ArgTypes...) const;
        ^
/Users/build/mrep/rep/Flow/FlowServer/main.cpp:13:8: note: definition of 'S' is not complete until the closing '}'
struct S {
       ^
1 error generated.`