Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Godbolt__Matt
Beginner
253 Views

GCC interop / C++0x support in 12.0.2

We're hoping to use icpc in place of gcc 4.5.x. We use a fairly small subset of C++0x, but we're unable to build any code at all, getting error messages upon trying to use enum classes, for example:

enum class Foo { Bar, Baz };
int main(int argc, const char* argv[]) {
Foo f = Foo::Bar;
return 1;
}
enum class Foo { Bar, Baz };
int main(int argc, const char* argv[]) {Foo f = Foo::Bar;return 1;}
$ icpc -std=c++0x /tmp/foo.cc
/tmp/foo.cc(4): error: name followed by "::" must be a class or namespace name
Foo f = Foo::Bar;
-- are enum classes not implemented? The syntax seems partially supported (if I don't specify the -std=c++0x I get different errors)
More worryingly if I "fix" this I then get a problem where ICC isn't defining GCC's __GXX_EXPERIMENTAL_CXX0X__ macro:
/usr/include/c++/4.5.1/bits/c++0x_warning.h(31): catastrophic error: #error directive: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
#error This file requires compiler and library support for the upcoming \\
^
... If I then manually define this constant I get an absolute ton of errors throughout the GCC headers.
I tried with gcc4.4 headers too and get a different set of errors.
What am I doing wrong, or does icpc not support GCC 4.4+ and/or C++0x at all?
0 Kudos
2 Replies
JenniferJ
Moderator
253 Views

The full support of C++0x enum feature will be in the next release.

Thanks,
Jennifer
Godbolt__Matt
Beginner
253 Views

Thanks for your response.
I'm glad to hear that you're working on the enum class issue.
As we can work around enum class quite easily (with some code modifications), can you also perhaps elaborate on the other issues I saw too? Specifically the errors in the GCC headers, requiring the special GCC macro to be defined etc?
Thanks, Matt
Reply