Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Status of strongly typed enums support in version 13.0

Dmitrichenko__Max
1,096 Views

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? )

0 Kudos
10 Replies
Judith_W_Intel
Employee
1,096 Views
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.
0 Kudos
Comron_S_
Beginner
1,096 Views

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.

0 Kudos
JenniferJ
Moderator
1,096 Views

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>

0 Kudos
Comron_S_
Beginner
1,096 Views

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-update-version-numbers-to-compiler-version-number-mapping, so maybe this is just a bug in the linux code? (Somehow that doesn't seem right though)

Any help would be appriciated. 

0 Kudos
JenniferJ
Moderator
1,096 Views

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>

0 Kudos
SergeyKostrov
Valued Contributor II
1,096 Views
>>... >>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?
0 Kudos
Comron_S_
Beginner
1,096 Views

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.

0 Kudos
Comron_S_
Beginner
1,096 Views

Is there any update on this?

0 Kudos
Judith_W_Intel
Employee
1,096 Views

 

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

0 Kudos
JenniferJ
Moderator
1,096 Views

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

0 Kudos
Reply