Bug related to initializer lists and initialization of static const members of a template class

Bug related to initializer lists and initialization of static const members of a template class


I think I found a bug in the Linux Version of the Intel c++ composer xe (version 14.0.2 20140120). Here is a small test case:

template<class TYPE>
class ReferenceElement {
  static const std::vector<int> subEntityTypes_;
const std::vector<int> ReferenceElement<int>::subEntityTypes_{ 1 };
int main() {
  return 0;

This code snippet compiles fine with Clang 3.4 and gcc 4.8.2, but if I try it with the Intel compiler on linux I get the following error message:

main.cpp(11): error: expected a ";"
const std::vector<int> ReferenceElement<int>::subEntityTypes_{ 1 };


I hope this can be fixed eventually...


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


Initializer lists are working with 14.0 compilers using a g++ 4.6 or higher environment.

Regards, Hubert.

Hi Hubert,

Thank you for the quick response. Do you know how I can find the version of my gcc environment, respectively what exactly do you mean with this? On my machine there is only gcc 4.8.2 installed so I believe the environment is also gcc 4.8.2.

Also I'd like to add that initializer_lists generally work with intel compiler but in this one particular case they don't. There are a few modifications you can make to the source to make it work:

- Remove the template argument from the template ReferenceElement

- Make the static const member a usual member and initialize it in a constructor.



Hi Raffael,

                   I was able to reproduce the issue that you are speaking about with both 14.0 and 15.0 version of the Intel(R) compiler. What Hubert meant to say maybe was that the above test case works fine with gcc/g++ 4.6 or higher. Yes, he is right. There is no issue with gcc/g++ for the above version when i tried with gcc-4.8.1.

shv@dpdknf01:~/quad$ icpc init_list1.cpp -std=c++11 
init_list1.cpp(15): error: expected a ";"
  const std::vector<int> ReferenceElement<int>::subEntityTypes_{ 1 };

compilation aborted for init_list1.cpp (code 2)

shv@dpdknf01:~/quad$ g++ init_list1.cpp -std=c++11

shv@dpdknf01:~/quad$ ./a.out
ref element 1

shv@dpdknf01:~/quad$ g++ --version
g++ (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

shv@dpdknf01:~/quad$ icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version Build 20140805
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

Also gcc environment basically mean the compiler and other set of tools , put in simple way, its the binutils.

I would escalate this issue to our engineering team. Thanks for let us know about this issue.


Sukruth H V

Dear Sukruth,

Thanks a lot for taking the time, I really appreciate it and I hope that I was able to improve the quality of the intel compiler by a tiny bit :)


Leave a Comment

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