Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Inline variable support in intel 19 compiler

$
0
0
The following code compiles and runs properly with gcc 8.2.0 (using -std=c++17).
It also compiles with icc 19.0.1.144, but throws a 'Floating point exception' when trying to access 'map' in the constructor.

#include <iostream>
#include <unordered_map>

struct A {
    static inline std::unordered_map<int, int> map;
    A(){
        map[1] = 2;
    }
};

int main(){
    A a;
}

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?

This question was first posted here


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>