我正在使用clang 3.4和emscripten的最新版本。

如果我尝试使用C ++ 14编译Hello World

emcc main.cpp -std=c++1y -o test.html


Emscripten是否可以与C ++ 14一起使用?

错误:

In file included from main.cpp:1:
In file included from /usr/share/emscripten/system/include/libcxx/iostream:38:
In file included from /usr/share/emscripten/system/include/libcxx/ios:216:
In file included from /usr/share/emscripten/system/include/libcxx/__locale:15:
In file included from /usr/share/emscripten/system/include/libcxx/string:439:
In file included from /usr/share/emscripten/system/include/libcxx/algorithm:627:
In file included from /usr/share/emscripten/system/include/libcxx/memory:601:
/usr/share/emscripten/system/include/libcxx/__functional_base:72:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
In file included from main.cpp:1:
In file included from /usr/share/emscripten/system/include/libcxx/iostream:38:
In file included from /usr/share/emscripten/system/include/libcxx/ios:216:
In file included from /usr/share/emscripten/system/include/libcxx/__locale:18:
In file included from /usr/share/emscripten/system/include/libcxx/mutex:177:
/usr/share/emscripten/system/include/libcxx/functional:506:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:531:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:556:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:581:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:606:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:631:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_Tp&& __x) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:656:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:681:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:706:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:733:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:758:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:783:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:808:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:833:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_Tp&& __x) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:858:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:883:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:908:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_T1&& __t, _T2&& __u) const
         ^
/usr/share/emscripten/system/include/libcxx/functional:929:10: error: constexpr function's return type 'auto' is not a literal type
    auto operator()(_Tp&& __x) const
         ^
19 errors generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting

最佳答案

更新:从版本1.28开始,Emscripten使用Clang 3.4,因此该版本中提供了C ++ 14功能!

Emscripten的LLVM + Clang实现Fastcomp目前基于Clang 3.3(Emscripten版本1.26)。
因此答案是否定的,Emscripten目前不适用于C ++ 14。

07-24 09:44
查看更多