- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ldalessa:~/temp$ cat test.cpp #include <atomic> struct Foo { Foo() : foo_() { } std::atomic<int> foo_[2]; }; int main() { } ldalessa:~/temp$ gcc --version gcc (GCC) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ldalessa:~/temp$ gcc -std=c++11 test.cpp ldalessa:~/temp$ icpc --version icpc (ICC) 15.0.4 20150805 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. ldalessa: ~/temp$ icpc -std=c++11 test.cpp test.cpp(4): internal error: assertion failed at: "shared/cfe/edgcpfe/decl_inits.c", line 6224 Foo() : foo_() { } ^ compilation aborted for test.cpp (code 4)
Current workaround is to skip the initializer for this member variable.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your bug report. The problem still exists in our current compiler and I have submitted it as DPD200414465 in our bugs database. The problem can be reproduced in this small test case:
struct atomic
{
atomic() = default;
};
struct C {
C() : b() { }
atomic b[2];
};
I think the constructor initializer (foo_()) in your code is unnecessary for atomics -- the default constructor for each member of the array will automatically be called since each field is default-initialized. So that might be a change (just remove it) that you could use as a workaround.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that's the workaround I'm currently using. It's mostly a documentation issue for us at the moment since the resulting code violates our enforced style without an explicit initializer for every field.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a simple fix for this which I'm currently testing so it should be fixed in 17.0 update 1.
Good to hear you have an acceptable workaround in the meantime...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page