Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.10.1
-
None
-
Visual Studio 2017 Update 6, x86 target platform
-
8dd78e8564d8c4249e85653a8119c1dd1a03d659 c59cb9809559f0aae6be8544cb2049e41f8040e9
Description
Consider the following code:
#define __cpp_constexpr 201304 #include <qalgorithms.h>
The code fails when compiled with Visual Studio 2017 Update 6 (C++17 mode) for x86 platform:
>cl main.cpp -IC:\Qt\5.10.1\msvc2017_64\include\QtCore -IC:\Qt\5.10.1\msvc2017_64\include -std:c++17 Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26129 for x86 Copyright (C) Microsoft Corporation. All rights reserved. main.cpp C:\Qt\5.10.1\msvc2017_64\include\QtCore\qalgorithms.h(847): error C3615: constexpr function 'qCountLeadingZeroBits' cannot result in a constant expression C:\Qt\5.10.1\msvc2017_64\include\QtCore\qalgorithms.h(858): note: failure was caused by call of undefined function or one not declared 'constexpr' C:\Qt\5.10.1\msvc2017_64\include\QtCore\qalgorithms.h(858): note: see usage of 'qPopulationCount'
The code compiles fine for x64 target.
The issue seemingly comes from using non-constexpr intrinsics like _BitScanReverse in functions marked with constexpr.
Attachments
Issue Links
- is duplicated by
-
QTBUG-70116 Configuration fails on MSVC 19.15
- Closed
For Gerrit Dashboard: QTBUG-67259 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
224386,4 | Fix MSVC2017 compilation with enabled relaxed constexpr on 32-bit target | 5.11 | qt/qtbase | Status: MERGED | +2 | 0 |
236948,2 | Fix MSVC2017 compilation with enabled relaxed constexpr on 32-bit target | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |