Status of strongly typed enums support in version 13.0

Status of strongly typed enums support in version 13.0

What is the status of subj support for Linux version?

Attached is the test input for compiler. It accepts enum declaration but refuses to see enum values. Is it a bug or a feature? )

AnexoTamanho
Download test.cpp239 bytes
11 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

This is a feature.

With c++11 scoped enums, the scoping of the enumeration is also defined as the enumeration name's scope. Using the enumerator names requires explicitly scoping. Unfortunately if you do this in your example you hit a known bug -- Intel currently does not allow scoped enums as case labels. This is entered in our bug database as DPD200289819.

Attached is an example reproducing this bug. This is a regression from the 12.x version of the compiler, and I hope it gets a higher priority for fixing.

Anexos: 

AnexoTamanho
Download intelbug.cpp1.07 KB

Quote:

Comron S. wrote:

Attached is an example reproducing this bug. This is a regression from the 12.x version of the compiler, and I hope it gets a higher priority for fixing.

what are the cmd options used? I'm not able to duplicate this issue from "intelbug.cpp".

C:\Jennifer\Issues>icl /c /Qstd=c++0x intelbug.cpp
Intel(R) C++ Compiler XE for applications running on IA-32, Version 13.1.1.171 Build 20130313
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.

intelbug.cpp

C:\Jennifer\Issues>

Hi Jennifer here is how I've been able to reproduce it:

$ icpc -o intelbug --std=c++0x intelbug.cpp
intelbug.cpp(14): error: expression must have integral or unscoped enum type
case test_enum_t::ONE:
^

intelbug.cpp(17): error: expression must have integral or unscoped enum type
case test_enum_t::TWO:
^

intelbug.cpp(20): error: expression must have integral or unscoped enum type
case test_enum_t::THREE:
^

compilation aborted for intelbug.cpp (code 2)
$ icpc --version
icpc (ICC) 13.1.1 20130313
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.

This linux version number seems to correlate to yorur windows version number according to http://software.intel.com/en-us/articles/intel-compiler-and-composer-upd..., so maybe this is just a bug in the linux code? (Somehow that doesn't seem right though)

Any help would be appriciated. 

Ok. I can duplicate the error with 13.1, but with 12.1, I still get errors. 

Below is the 12.1 errors: 

/quad/issues> icpc -o intelbug --std=c++0x intelbug.cpp
icpc: command line warning #10006: ignoring unknown option '-fstd=c++0x'
intelbug.cpp(4): error: expected either a definition or a tag name
enum class test_enum_t : int {
^
intelbug.cpp(4): error: expected an identifier
enum class test_enum_t : int {
^
intelbug.cpp(4): error: expected a ";"
enum class test_enum_t : int {
^
intelbug.cpp(8): warning #12: parsing restarts here after previous syntax error
};
^
intelbug.cpp(11): error: identifier "test_enum_t" is undefined
test_enum_t value = test_enum_t::TWO;
^
intelbug.cpp(11): error: name followed by "::" must be a class or namespace name
test_enum_t value = test_enum_t::TWO;
^
intelbug.cpp(14): error: name followed by "::" must be a class or namespace name
case test_enum_t::ONE:
^
intelbug.cpp(17): error: name followed by "::" must be a class or namespace name
case test_enum_t::TWO:
^
intelbug.cpp(20): error: name followed by "::" must be a class or namespace name
case test_enum_t::THREE:
^

compilation aborted for intelbug.cpp (code 2)
/quad/issues> icpc --version
icpc (ICC) 12.1.6 20120928
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

/quad/issues>

>>...
>>intelbug.cpp(4): error: expected an identifier
>>enum class test_enum_t : int {
>>...

Are you sure that Intel C++ compiler version 12.x supports these C++11 declarations?

Yes, I'm quite sure it works. You seem have the wrong -std flag in your test case.

> icpc -o intelbug -std=c++0x intelbug.cpp
> ./intelbug
Case TWO
> icpc --version
icpc (ICC) 12.1.3 20120212
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

Is there any update on this?

 

This is fixed in the 14.0 beta. The problem was that scoped enums weren't allowed as case labels (DPD200289819) not that the feature wasn't supported. Jennifer, the reason you were getting errors with 12.1 is because you were using the --std=c++0x not the -std=c++0x option.

Judy

yeh, Judy and Comron S are right. I used "--std" instead "-std" when trying with icpc 12.1.

btw. to get the 14.0 beta, you can join the beta program and download it. see this posting.

Jennifer

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!