Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
39 Views

Inline variable support in intel 19 compiler

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

0 Kudos
3 Replies
Highlighted
Moderator
39 Views

I've reported this problem to our Developer.  An internal case is  #CMPLRIL0-31151

Thanks,

0 Kudos
Highlighted
Beginner
39 Views

Hi,

Where can I find out if this issue was handled in newer icc versions?

Should the internal case number appear anywhere?

Apologies. I'm new to these things...

0 Kudos
Highlighted
39 Views

What is the purpose of the use of inline on an object?

Is this to possibly attribute inline to all the member functions?
The place for this would be inside the template(s).

Jim Dempsey

EDIT: Nevermind, I see: https://www.codingame.com/playgrounds/2205/7-features-of-c17-that-will-simplify-your-code/inline-var...

 

0 Kudos