【问题标题】:CLANG vs. GNU Compilers Collection - Compiles in GNU but fails in CLANGCLANG vs. GNU Compilers Collection - 在 GNU 中编译但在 CLANG 中失败
【发布时间】:2014-11-12 12:07:54
【问题描述】:

我正在尝试使用带有 clang++ 的 MAC OS X 10.9.5 Mavericks 中的第 3 方库“ACE 6.2.8”编译我的项目。

我收到以下错误:

In file included from ../../../Client/Chromodoris/Agent/CacheGenerator.cpp:15:
In file included from ../../../Client/Chromodoris/Agent/ACEIncludes.h:22:
In file included from ../../../Client/Chromodoris/ExternalLibs/ACE_wrappers/ace/OS.h:53:
In file included from ../../../Client/Chromodoris/ExternalLibs/ACE_wrappers/ace/Cleanup.h:30:
In file included from ../../../Client/Chromodoris/ExternalLibs/ACE_wrappers/ace/Intrusive_List.h:128:
In file included from ../../../Client/Chromodoris/ExternalLibs/ACE_wrappers/ace/Intrusive_List.inl:5:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:627:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4013:35: error: no viable overloaded '='
            __e->__weak_this_ = *this;
            ~~~~~~~~~~~~~~~~~ ^ ~~~~~

是不是 CLANG++ 编译器有问题?有什么解决办法吗?

附加信息:

Moamen-MacBook:ace Moamen$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

请注意我的代码正在调用第 3 方库 (ACE),它会调用出现问题的 CLANG++ 工具链。

注意相同的代码在 GNU Compiler 集合下编译。 我相信这个问题是相关的: which of these compilers has a bug, according to the standard?

【问题讨论】:

  • 您需要提供代码示例,否则我们只是猜测。
  • 即将推出的 ACE 6.3.0 将对 clang-600 进行一组修复,但不确定此特定错误是由 ACE 还是某些应用程序代码触发的。
  • 请问6.3.0什么时候发布?
  • 可能在本周五,就目前的测试结果而言,最迟是下周一
  • 非常感谢约翰尼!

标签: c++ macos osx-mavericks clang++ ace


【解决方案1】:

我找到了解决方法。

我收到一条注释消息,在上述错误之后 2-3 行(抱歉,没有消息!),告诉我无法从基类转换为派生类。

使用派生类对象而不是基类对象,应该解决问题。 注意 - 您可以使用基类而不是派生类,但这取决于您的实现和需求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多