我的理论是 gcc 有一个错误。以下在 clang 和 gcc 中编译:
using type = const struct {}&;
但是现在当我将其更改为右值引用时,它会使用 clang 而不是 gcc 编译:
using type = const struct {}&&;
// main.cpp:8:17: error: expected ';' after struct definition
// typedef struct {}&& type;
// ^
// main.cpp:8:17: error: missing type-name in typedef-declaration
// main.cpp:8:22: error: expected constructor, destructor, or type conversion before ';' token
// typedef const struct {}&& type;
// ^
它也因版本而失败,typedef
并出现相同的错误:
typedef const struct {}&& type;
为什么这无法在 gcc 中编译?这是标准的问题还是错误?