XLC:模板化类的大小不起作用
xlc: sizeof of templated class not working
我在模板参数中使用sizeof(),如下所示:
#include <iostream>
template<class A>
struct Foo {
A a;
};
template<class A, size_t S = sizeof(Foo<A>)>
class Bar {
public:
Bar() {
// prints 4, as expected
std::cout << sizeof(Foo<A>) << std::endl;
// prints 1! why?
std::cout << S << std::endl;
}
};
int main(int, char**) {
Bar<int> foo;
}
出于某种原因,xlc++ 决定sizeof(Foo<A>)
作为默认模板参数的结果为 1。为什么会这样?这是编译器错误吗?它在Visual Studio 2015中打印4,4。
我正在使用 xlc 版本 z/OS V2.1 XL C/C++
.
它可能是编译器中的一个错误,该错误已在 AIX 上修复,但在 Z 上未修复
在 AIX 上测试最新(即 PTF)版本V13.1.3 预期结果V13.1 预期结果V12.1 预期结果V11.1 预期结果
在佐斯上V2R1 失败V2R2 失败
如果您报告该错误,我们可以将修复程序放入 V2R1 中。
相关文章:
- 我的神经网络不起作用 [XOR 问题]
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- C++映射:具有自定义类的运算符[]不起作用(总是返回0)
- C++为什么尽管我调用了void函数,它却不起作用
- 为什么在保护模式下继承升级不起作用
- 循环在计数器中不起作用
- 在其他文件中创建类时在 c++ 项目中不起作用
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- 为什么二进制搜索在我的测试中不起作用
- 我的代码中有错误吗?使用BGI图形的C++代码对我不起作用
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- 带有指定长度字符* 参数的 std::regex_search 在 VS2017 中不起作用?
- Bjarne Stroustrup Book - std_lib_facilities.h - 不起作用(未知类型名称)
- 为什么简单的算术减法在"if"条件下不起作用?
- 为什么Stroustup书中的has_f不起作用
- 你能检查一下为什么在这个代码中从链接列表中删除项目不起作用吗
- 嵌套While循环不起作用(C++问题)
- C++Matching Brackets 2解决方案不起作用
- 为什么这段代码不起作用,我该如何解决?
- XLC:模板化类的大小不起作用