compiler fails on enum assignment

compiler fails on enum assignment

icpc version 13.1.3 cannot compile this simple code

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>;

but complains with the error message 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

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

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


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



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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today