01The following code compiles and runs properly with gcc 8.2.0 (using -std=c++17).
02It also compiles with icc 19.0.1.144, but throws a 'Floating point exception' when trying to access 'map' in the constructor.
03
04#include <iostream>
05#include <unordered_map>
06
07struct A {
08 static inline std::unordered_map<int, int> map;
09 A(){
10 map[1] = 2;
11 }
12};
13
14int main(){
15 A a;
16}
A similar code with a primitive or 'std::vector' in place of 'std::unordered_map' does appears to work.
Am I missing something or is this a problem with the compiler?