-
Notifications
You must be signed in to change notification settings - Fork 13.5k
"Eagerly instantiate used constexpr function upon definition" broke compiling Qt #74069
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
duplicate
Resolved as duplicate
regression
Comments
@llvm/issue-subscribers-clang-frontend Author: Martin Storsjö (mstorsjo)
Since 030047c, Qt (tested with 6.6) fails to compile, with errors like this:
```
In file included from /home/martin/code/qt/src-6.6/src/corelib/compat/removed_api.cpp:12:
In file included from include/QtCore/qmetatype.h:1:
include/QtCore/../../../src-6.6/src/corelib/kernel/qmetatype.h:2669:1: error: explicit specialization of 'QMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>' after instantiation
2669 | QT_DECL_METATYPE_EXTERN_TAGGED(QtMetaTypePrivate::QPairVariantInterfaceImpl,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2670 | QPairVariantInterfaceImpl, Q_CORE_EXPORT)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/QtCore/../../../src-6.6/src/corelib/kernel/qmetatype.h:1361:5: note: expanded from macro 'QT_DECL_METATYPE_EXTERN_TAGGED'
1361 | Q_DECLARE_METATYPE(TYPE) \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/QtCore/../../../src-6.6/src/corelib/kernel/qmetatype.h:1504:34: note: expanded from macro 'Q_DECLARE_METATYPE'
1504 | #define Q_DECLARE_METATYPE(TYPE) Q_DECLARE_METATYPE_IMPL(TYPE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/QtCore/../../../src-6.6/src/corelib/kernel/qmetatype.h:1508:12: note: expanded from macro 'Q_DECLARE_METATYPE_IMPL'
1508 | struct QMetaTypeId< TYPE > \
| ^~~~~~~~~~~~~~~~~~~
include/QtCore/../../../src-6.6/src/corelib/kernel/qmetatype.h:1220:22: note: implicit instantiation first required here
1220 | enum { Defined = QMetaTypeId<T>::Defined, IsBuiltIn=false };
| ^
1 error generated.
```
Before this commit, this file built just fine. This can be reproduced with this attached preprocessed file, CC @cor3ntin |
Reduced to template <typename> constexpr static void fromType();
void registerConverter() { fromType<int>(); }
template <typename> struct QMetaTypeId {};
template <typename T> constexpr void fromType() {
(void)QMetaTypeId<T>{};
}
template <> struct QMetaTypeId<int> {};
|
@zygoloid I'm not 100% sure but GCC does seem to do instantiations during evaluation https://godbolt.org/z/Wz5oMzdnP |
Lets keep the discussion in #73232 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
duplicate
Resolved as duplicate
regression
Since 030047c, Qt (tested with 6.6) fails to compile, with errors like this:
Before this commit, this file built just fine. This can be reproduced with this attached preprocessed file,
qt-preproc.zip, compiled as
clang -target armv7-w64-mingw32 -c qt-preproc.cpp
.CC @cor3ntin
The text was updated successfully, but these errors were encountered: