Work around ICC bug in brace initializations containing constexpr

ICC miscompiles this:

struct Inner { int i; constexpr Inner(int i) : i(i) {}};
struct Outer { Inner i; };
const Outer x = { -1 };

(Inner = QBasicAtomicInt; Outer = QtPrivate::RefCount, then again for
QListData::Data)

We expect x to be placed in read-only memory and require no load-time
constructor. ICC unfortunately does not do that. By adding a constexpr
constructor to Outer, it starts behaving like we expect it to, but falls
apart again if you do "const Outer x[]" (the QArrayData statics).

The solution is to probably make the varaibles constexpr too, but that's
a job for the development branch.

Intel issue Id: 6000056211
Intel bug: DPD200534796
Change-Id: Ie9fb5428106486254b7329403890754f300d58c1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira 2014-06-26 22:59:19 -07:00
parent b6d50e2aa6
commit d88e4edcd5

View File

@ -530,7 +530,8 @@
# define Q_COMPILER_NOEXCEPT
# endif
# if __INTEL_COMPILER >= 1400
# define Q_COMPILER_CONSTEXPR
// causes issues with QArrayData and QtPrivate::RefCount - Intel issue ID 6000056211, bug DPD200534796
//# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_NONSTATIC_MEMBER_INIT