I am just curious whether an enum class can be final or not ... since the compilers are giving me contradictory results.
Consider the code:
#include <iostream>
enum class some_enums final : char
{
a = 'a',
b = 'b',
c = 'c'
};
int main()
{
some_enums aa = some_enums::a;
std::cout << "aa=" << static_cast<char>(aa) << std::endl;
}
Compiling this with Visual Studio 2015 compiler (http://ift.tt/28Tayem) works... however compiling it with clang (http://ift.tt/2bynScT) gives me an error:
source_file.cpp:3:30: error: expected ';' after top level declarator
enum class some_enums final : char
I have seen no traces of final enum classes anywhere in the standard so I give credit to clang ... however why does Visual Studio accept it in this case although it is not mentioned in MSDN (http://ift.tt/2byCMLn) ?
Aucun commentaire:
Enregistrer un commentaire