[clang] [Clang] skip default argument instantiation for non-defining friend declarations without specialization info to meet [dcl.fct.default] p4 (PR #113777)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 02:09:00 PST 2024
mstorsjo wrote:
Thanks for the revert - FWIW, I also ran into issues with this change when building Qt.
Building the https://github.com/qt/qtbase repo fails with an error like this:
```
[790/790] Linking CXX shared library lib/libQt6Gui.so.6.8.0
FAILED: lib/libQt6Gui.so.6.8.0
/usr/bin/ld: src/gui/CMakeFiles/Gui.dir/painting/qpdf.cpp.o: in function `decltype (((std::declval<std::enable_if<((7)>(0)), void>::type>()),(((qHash(std::declval<QByteArray, QByteArray, int, int, int, QList<QFont::Tag>, QList<float> const&>())),...))),unsigned long{}) qHashMulti<QByteArray, QByteArray, int, int, int, QList<QFont::Tag>, QList<float> >(unsigned long, QByteArray const&, QByteArray const&, int const&, int const&, int const&, QList<QFont::Tag> const&, QList<float> const&)':
qpdf.cpp:(.text._Z10qHashMultiIJ10QByteArrayS0_iii5QListIN5QFont3TagEES1_IfEEEDTcmcmclsr3stdE7declvalINSt9enable_ifIXgtsPDpT_ELi0EEvE4typeEEEfrcmcl5qHashclsr3stdE7declvalIRKS7_EEEtlmEEmDpSC_[_Z10qHashMultiIJ10QByteArrayS0_iii5QListIN5QFont3TagEES1_IfEEEDTcmcmclsr3stdE7declvalINSt9enable_ifIXgtsPDpT_ELi0EEvE4typeEEEfrcmcl5qHashclsr3stdE7declvalIRKS7_EEEtlmEEmDpSC_]+0x9a): undefined reference to `unsigned long QtPrivate::QHashCombine::operator()<QFont::Tag>(unsigned long, QFont::Tag const&) const'
/usr/bin/ld: src/gui/CMakeFiles/Gui.dir/text/qfont.cpp.o: in function `decltype (((std::declval<std::enable_if<((13)>(0)), void>::type>()),(((qHash(std::declval<long long, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, QList<QString>, QString, unsigned int, QList<QFont::Tag>, QList<float> const&>())),...))),unsigned long{}) qHashMulti<long long, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, QList<QString>, QString, unsigned int, QList<QFont::Tag>, QList<float> >(unsigned long, long long const&, unsigned int const&, unsigned int const&, unsigned int const&, unsigned int const&, unsigned int const&, unsigned int const&, unsigned int const&, QList<QString> const&, QString const&, unsigned int const&, QList<QFont::Tag> const&, QList<float> const&)':
qfont.cpp:(.text._Z10qHashMultiIJxjjjjjjj5QListI7QStringES1_jS0_IN5QFont3TagEES0_IfEEEDTcmcmclsr3stdE7declvalINSt9enable_ifIXgtsPDpT_ELi0EEvE4typeEEEfrcmcl5qHashclsr3stdE7declvalIRKS8_EEEtlmEEmDpSD_[_Z10qHashMultiIJxjjjjjjj5QListI7QStringES1_jS0_IN5QFont3TagEES0_IfEEEDTcmcmclsr3stdE7declvalINSt9enable_ifIXgtsPDpT_ELi0EEvE4typeEEEfrcmcl5qHashclsr3stdE7declvalIRKS8_EEEtlmEEmDpSD_]+0x13a): undefined reference to `unsigned long QtPrivate::QHashCombine::operator()<QFont::Tag>(unsigned long, QFont::Tag const&) const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```
In a build with static libraries, where this didn't cause immediate errors, I also ran into build errors while building qtdeclarative. I didn't bisect that failure, but it seems closely related:
```
qtdeclarative/src/qmlcompiler/qqmljsregistercontent_p.h:250:20: error: no matching function for call to 'qHashMulti'
250 | return qHashMulti(
| ^~~~~~~~~~
aarch64-w64-mingw32/include/QtCore/qhashfunctions.h:344:1: note: candidate template ignored: substitution failure [with T = <QQmlJSMetaProperty, int, int>]
344 | qHashMulti(size_t seed, const T &... args)
| ^
aarch64-w64-mingw32/include/QtCore/qhashfunctions.h:390:12: error: no matching function for call to 'qHashMulti'
390 | return qHashMulti(seed, key.first, key.second);
| ^~~~~~~~~~
qtdeclarative/src/qmlcompiler/qqmljsregistercontent_p.h:157:20: note: in instantiation of function template specialization 'qHash<QQmlJSMetaEnum, QString>' requested here
157 | return qHash(std::get<std::pair<QQmlJSMetaEnum, QString>>(registerContent.m_content),
| ^
aarch64-w64-mingw32/include/QtCore/qhashfunctions.h:344:1: note: candidate template ignored: substitution failure [with T = <QQmlJSMetaEnum, QString>]
344 | qHashMulti(size_t seed, const T &... args)
| ^
4 errors generated.
```
Before relanding, I would appreciate if you could try building qtbase with the new version of the suggested change!
https://github.com/llvm/llvm-project/pull/113777
More information about the cfe-commits
mailing list