Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Walter_D_
Beginner
64 Views

compiler fails on enum assignment

icpc version 13.1.3 cannot compile this simple code

[cpp]

enum which { none=0, some=1, all=2 };


template<bool X, bool Y>
struct foo
{
  static const which R = X? which::all : which::some;
  static const which L = Y? R : which::none;
};


template struct foo<1,0>;
[/cpp]

but complains with the error message

[plain]

test.cc(8): error: a value of type "int" cannot be used to initialize an entity of type "const which"
    static const which L = Y? R : which::none;
                           ^
          detected during instantiation of class "foo<X, Y> [with X=true, Y=false]" at line 8
[/plain]

Note that both gcc (4.8.1) and clang++ have no issues with this code.

0 Kudos
2 Replies
Judith_W_Intel
Employee
64 Views

 

Please update to the latest version of our compiler (14.0) where this problem is fixed. 13.1 is no longer being updated.

thanks

Judy

Walter_D_
Beginner
64 Views

thanks. Yes, I noted that myself (after posting this and after my admin installed 14.0.1). However there are other (minor so far) issues with 14.0.1 ... I will open another thread for that.

Reply