我在 IDE 中使用 Embarcader C++Builder 10.4.2 和 Clang32 编译器来构建 VCL Windows 32 位应用程序。
当我使用旧的“经典”编译器时,我曾经()
为自己的常量使用初始化器。TColor
但是 Clang32 编译器不接受这个。Clang32 确实接受相同的初始化值,但使用 C++ 17(我认为更早){}
初始化程序。
感谢 Remy 的建议:我应该在原始帖子中包含错误消息。Clang32编译器报错的信息是:
[C++ 错误] Unit1.cpp(15, 13): 无法使用 'int' 类型的右值初始化 'const System::Uitypes::TColor' 类型的变量
我不明白为什么 Clang32 不喜欢()
初始化语法。谁能解释一下?
附上代码示例:
#include <vcl.h>
const TColor MeterBarBezelRimColour{0x00DDDDDD}; // works with Clang32 - (too "modern" for Classic compiler)
const TColor AnotherBezelRimColour(0x00CCCCCC); // give an error with Clang32 (but does work for Classic compiler).
// WHY is this not accepted by Clang?