草庐IT

compiler-bug

全部标签

c++ - x86/C++ - 指向指针 : Const being violated by compiler? 的指针

我正在为我的学生项目的游戏引擎开发一个共享指针(称为句柄)实现,我们遇到了一个我们无法解释的错误。出于某种原因,在我们工厂的某个时刻,有一个无效的内部指针通过句柄传递给工厂,这导致我们的原型(prototype)加载期间发生崩溃。我们调试了几个小时的过程,并将任何复杂的语句分解为最简单的版本,以便于调试。我最终将问题归结为Handle类的复制构造函数。但是,似乎仍然存在释放内部指针的中间步骤。我阅读了所有我能找到的关于可能导致此问题的文章,但没有找到任何内容。最后,我决定查看反汇编代码,看看我是否能弄清楚发生了什么。这是没有反汇编的复制构造函数。templateHandle::Hand

c++ - Visual Studio 2012 : C++ compiler ignoring user-specified include directories

我遇到常见错误fatalerrorC1083:Cannotopenincludefile:'afxres.h':Nosuchfileordirectory。搜索引擎为此显示了很多匹配项,但没有一个建议的解决方案对我有用。通常这看起来是路径问题。所以,我确保安装了相关的库,并找到了文件。使用绝对路径作为#include工作正常:#include"C:\ProgramFiles(x86)\MicrosoftVisualStudio11.0\VC\atlmfc\include\afxres.h"但是,如果我将目录(C:\ProgramFiles(x86)\MicrosoftVisualStu

c++ - "The C++ compiler "/usr/bin/c++ "is not able to compile a simple test program."尝试安装 OpenCV 时

我正尝试按照此link在我的Mac上安装OpenCV但是,当我在终端上键入cmake-G"UnixMakefiles"..时,会打印出此错误。--TheCXXcompileridentificationisunknown--TheCcompileridentificationisunknown--CheckforworkingCXXcompiler:/usr/bin/c++--CheckforworkingCXXcompiler:/usr/bin/c++--brokenCMakeErrorat/opt/local/share/cmake-3.0/Modules/CMakeTestCXX

c++ - 铿锵错误 : non-type template argument refers to function that does not have linkage -- bug?

我有一些非常简单的(C++11)代码,最新的clang(version3.4trunk187493)无法编译,但GCC编译正常。代码(下面)实例化函数模板foo使用局部函数类型Bar然后尝试将其地址用作类模板Func的非类型模板参数:templatestructFunc{};templateexterninlinevoidfoo(){usingFoo=Func>;}intmain(){structBar{};//function-localtypefoo();return0;}clang发出以下错误:error:non-typetemplateargumentreferstofunct

c++ - VS2010 : "Cannot find the resource compiler DLL. Please make sure the path is correct."

我一直在关注theForger'swin32APItutorial,然后我决定打开menu_one.rc文件以从VS2010中查看其内容,但我收到此错误:我已经仔细检查了这两个位置,但实际上这两个文件都不存在。我仅有的rcdll.dll拷贝位于:C:\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Bin\rcdll.dllandC:\ProgramFiles(x86)\MicrosoftSDKs\Windows\v7.0A\Bin\x64\rcdll.dll我试过做repairinstalloftheWindowsSDK,但这并没有解决问题

C++ v 表 : Part of the language or compiler dependent?

v表(virtualmethodtable)是C++规范的一部分,还是由编译器来解决虚方法查找?如果它是规范的一部分:为什么?我猜它依赖于编译器,但有人对我说它是规范的一部分。非常欢迎引用! 最佳答案 1.7TheC++memorymodel3[...]Variousfeaturesofthelanguage,suchasreferencesandvirtualfunctions,mightinvolveadditionalmemorylocationsthatarenotaccessibletoprogramsbutaremana

c++ - 在 Xcode : error during compilation: STL vector 中编译 C++ 类

我有一个C++类,它可以在带有gcc的Linux上和在visualstudio中的widows上正常编译。boid.h:#ifndefBOID_CLASS_HEADER_DEFINES_H#defineBOID_CLASS_HEADER_DEFINES_H#include"defines.h"classBoid{public://Initializetheboidwithrandomposition,headingdirectionandcolorBoid(floatSceneRadius,floatNormalVel);.....protected:...};#endif在boid.

c++ - 使用可变参数模板重载函数模板 : Intel c++ compiler version 18 produces different result from other compilers. intel 错了吗?

考虑以下代码片段:templateclassA,typename...Ts>inta(Aarg){return1;//Overload#1}templateinta(Aarg){return2;//Overload#2}templatestructS{};intmain(){returna(S());}在使用模板类的实例调用函数a时,我希望编译器选择更特殊的函数重载#1。根据compilerexplorer、clang、gcc和17版之前的英特尔实际上会选择重载#1。相反,后来的英特尔编译器版本(18和19)选择重载#2。是代码定义不正确还是最新的英特尔编译器版本有误?

c++ - 自动模板参数 : g++ 7. 3 vs clang++ 6.0 : Which compiler is correct?

对于这个代码示例,两个编译器会产生不同的结果。Clang生成两种不同的类型。G++对fu和fi使用相同的类型。哪个符合标准?#includetemplatestructfoo{decltype(IVAL)x=-IVAL;};intmain(){foofu;foofi;std::coutg++-7.3输出:42949672864294967286clang-6.0输出:-104294967286 最佳答案 gcc在这里是错误的,这显然是两种不同的类型。并确认-此错误已在gcc8.0.1中修复Samplecode

c++ - 带有 decltype : bug in clang or gcc? 的 sfinae

Clang-3.2可以编译并且代码按预期运行:structhave_f{intf(inti){return10;}};structempty{};templatestructouter{Tt;//ifThavef(),defineouter_f()templateintouter_f(inti){returnt.f(i);}};intmain(){outero1;outero2;//tosilenceunusedvarwarningreturno1.outer_f(10)+sizeof(o2);}任何版本的GCC拒绝:t.cc:13:6:error:‘structempty’hasno