mercredi 18 mars 2015

Using alias for reference to anonymous structure results in error


My theory is that gcc has a bug. The following compiles in both clang and gcc:



using type = const struct {}&;


But now when I change it to an rvalue reference it compiles with clang but not with 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;
// ^


It fails with the typedef version as well with the same error:



typedef const struct {}&& type;


Why does this fail to compile in gcc? Is this an issue with the standard or a bug?




Aucun commentaire:

Enregistrer un commentaire