声明__m256无法访问其成员后
After declaring a __m256 fail to access its members
当我尝试使用 icpc 编译时,它显示"表达式必须具有类类型"。对此感到困惑。请帮忙。
int main()
{
__m256d temp;
temp.m256d_f64[0] = 1;
return 0;
}
我可以在我这边重现这个问题。在英特尔编译器附带的 immintrin.h 中,我们对__m256d有以下定义:
typedef struct _MMINTRIN_TYPE(32) __m256d {
double m256d_f64[4];
} __m256d;
在上面的定义中,结构名称和别名是相同的,这混淆了当前的编译器。英特尔编译器似乎无法将 typedef 名称识别为可以用较小的测试用例证明的类:
$ cat test1.cc
typedef struct __m256d {
double m256d_f64[4];
} m256d;
int main()
{
__m256d temp;
temp.m256d_f64[0] = 1;
return 0;
}
$ icpc test1.cc –c
当我更改 typedef 并实例化 temp 时,如下所示(使用 typedefed 名称而不是结构名称(,ICC 失败,但 GCC 工作:
$ cat test1.cc
typedef struct m256d {
double m256d_f64[4];
} __m256d;
int main()
{
__m256d temp;
temp.m256d_f64[0] = 1;
return 0;
}
$ icpc test1.cc -c
test1.cc(8): error: expression must have class type
temp.m256d_f64[0] = 1;
^
compilation aborted for test1.cc (code 2)
$ g++ test1.cc -c
我已向英特尔的编译器工程团队报告了此问题。
相关文章:
- 这是关于成员访问规则的正确摘要吗
- 为什么我在空指针错误(链表)中获取成员访问权限
- 成员访问是否在空指针上定义C++?
- C++ IDE 不会推断/自动完成对模板类中的 std::array 下标表达式的成员访问
- 为什么类成员数据必须是静态的才能被模板化类的模板化结构成员访问
- 为什么c++允许成员函数定义中实例的私有成员访问
- C/C++ 包含点的宏参数(成员访问运算符)
- 访问说明符(私有/公共/受保护)如何在内部工作(限制成员访问)?
- 如何将超类的受保护成员访问到其派生类. 如果已在派生类中声明了具有相同名称的函数?
- 内部类私有成员访问和封闭的友好性
- 通过 C++ 中的另一个结构成员访问结构
- 具体化 PRVALUES 成员访问的 decltype 行为不正确
- 常量表达式中的静态成员访问
- XVALUE来自类成员访问表达式
- 未经授权的私有类成员访问会产生编译时错误而不是运行时错误?
- 在 c++ 中,为什么 -> 被称为二进制中缀指针成员访问运算符?
- 如何访问模板参数的成员?“成员访问不完整的类型”
- 不明确的可变参数类成员访问
- C 受保护的成员访问
- 将typeID转换为静态成员访问(C )的命名空间