Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ircmessage.cpp: error: could not convert from '<brace-enclosed initializer list>' to 'const QHash<QString, std::function<IrcMessage*(IrcConnection*)> >' #118

Open
barracuda156 opened this issue Jun 29, 2023 · 3 comments

Comments

@barracuda156
Copy link

ircmessage.cpp: In function 'IrcMessage* irc_create_message(const QString&, IrcConnection*)':
ircmessage.cpp:249:18: error: 'function' in namespace 'std' does not name a template type
  249 |     typedef std::function<IrcMessage *(IrcConnection *)> IrcMessageFactory;
      |                  ^~~~~~~~
ircmessage.cpp:41:1: note: 'std::function' is defined in header '<functional>'; did you forget to '#include <functional>'?
   40 | #include <QDebug>
  +++ |+#include <functional>
   41 | 
ircmessage.cpp:251:33: error: 'IrcMessageFactory' was not declared in this scope; did you mean 'IrcMessageFilter'?
  251 |     static const QHash<QString, IrcMessageFactory> factories = {
      |                                 ^~~~~~~~~~~~~~~~~
      |                                 IrcMessageFilter
ircmessage.cpp:251:50: error: template argument 2 is invalid
  251 |     static const QHash<QString, IrcMessageFactory> factories = {
      |                                                  ^
ircmessage.cpp:251:52: error: scalar object 'factories' requires one element in initializer
  251 |     static const QHash<QString, IrcMessageFactory> factories = {
      |                                                    ^~~~~~~~~
ircmessage.cpp:272:22: error: expected ';' before 'factory'
  272 |     IrcMessageFactory factory = factories.value(command);
      |                      ^~~~~~~~
      |                      ;
ircmessage.cpp:273:9: error: 'factory' was not declared in this scope
  273 |     if (factory)
      |         ^~~~~~~
@barracuda156
Copy link
Author

After adding the header, it still fails, though differently:

:info:build ircmessage.cpp: In function 'IrcMessage* irc_create_message(const QString&, IrcConnection*)':
:info:build ircmessage.cpp:271:5: error: could not convert '{{"ACCOUNT", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"AWAY", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"BATCH", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"CAP", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"ERROR", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"CHGHOST", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"INVITE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"JOIN", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"KICK", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"MODE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"NICK", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"NOTICE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PART", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PING", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PONG", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PRIVMSG", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"QUIT", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"TOPIC", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}}' from '<brace-enclosed initializer list>' to 'const QHash<QString, std::function<IrcMessage*(IrcConnection*)> >'
:info:build   271 |     };
:info:build       |     ^
:info:build       |     |
:info:build       |     <brace-enclosed initializer list>
:info:build In file included from ircmessage.cpp:30:
:info:build ../../include/IrcCore/ircmessage_p.h: In member function 'IrcExplicitValue<QStringList>& IrcExplicitValue<QStringList>::operator=(const IrcExplicitValue<QStringList>&)':
:info:build ../../include/IrcCore/ircmessage_p.h:46:7: warning: implicitly-declared 'QStringList& QStringList::operator=(const QStringList&)' is deprecated [-Wdeprecated-copy]
:info:build    46 | class IrcExplicitValue
:info:build       |       ^~~~~~~~~~~~~~~~
:info:build In file included from ../../include/IrcCore/ircmessage.h:38:
:info:build /opt/local/libexec/qt4/include/QtCore/qstringlist.h:71:12: note: because 'QStringList' has user-provided 'QStringList::QStringList(const QStringList&)'
:info:build    71 |     inline QStringList(const QStringList &l) : QList<QString>(l) { }
:info:build       |            ^~~~~~~~~~~
:info:build ircmessage.cpp: In member function 'IrcMessage* IrcMessage::clone(QObject*) const':
:info:build ircmessage.cpp:745:26: note: synthesized method 'IrcExplicitValue<QStringList>& IrcExplicitValue<QStringList>::operator=(const IrcExplicitValue<QStringList>&)' first required here
:info:build   745 |         p->m_params = d->m_params;
:info:build       |                          ^~~~~~~~
:info:build ircmessage.cpp: In member function 'QStringList IrcCapabilityMessage::capabilities() const':
:info:build ircmessage.cpp:988:72: warning: implicitly-declared 'QStringList& QStringList::operator=(const QStringList&)' is deprecated [-Wdeprecated-copy]
:info:build   988 |         caps = params.last().split(QLatin1Char(' '), Qt::SkipEmptyParts);
:info:build       |                                                                        ^
:info:build /opt/local/libexec/qt4/include/QtCore/qstringlist.h:71:12: note: because 'QStringList' has user-provided 'QStringList::QStringList(const QStringList&)'
:info:build    71 |     inline QStringList(const QStringList &l) : QList<QString>(l) { }
:info:build       |            ^~~~~~~~~~~
:info:build ircmessage.cpp: In member function 'IrcModeMessage::Kind IrcModeMessage::kind() const':
:info:build ircmessage.cpp:1382:66: warning: implicitly-declared 'QStringList& QStringList::operator=(const QStringList&)' is deprecated [-Wdeprecated-copy]
:info:build  1382 |             channelModes = net->channelModes(IrcNetwork::AllTypes);
:info:build       |                                                                  ^
:info:build /opt/local/libexec/qt4/include/QtCore/qstringlist.h:71:12: note: because 'QStringList' has user-provided 'QStringList::QStringList(const QStringList&)'
:info:build    71 |     inline QStringList(const QStringList &l) : QList<QString>(l) { }
:info:build       |            ^~~~~~~~~~~
:info:build ircmessage.cpp: In function 'IrcMessage* irc_create_message(const QString&, IrcConnection*)':
:info:build ircmessage.cpp:271:5: error: could not convert '{{"ACCOUNT", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"AWAY", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"BATCH", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"CAP", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"ERROR", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"CHGHOST", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"INVITE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"JOIN", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"KICK", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"MODE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"NICK", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"NOTICE", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PART", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PING", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PONG", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"PRIVMSG", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"QUIT", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}, {"TOPIC", <lambda closure object>irc_create_message(const QString&, IrcConnection*)::<lambda(IrcConnection*)>()}}' from '<brace-enclosed initializer list>' to 'const QHash<QString, std::function<IrcMessage*(IrcConnection*)> >'
:info:build   271 |     };
:info:build       |     ^
:info:build       |     |
:info:build       |     <brace-enclosed initializer list>

@barracuda156
Copy link
Author

UPD. Ah, header was added already, I am using a bit older commit before the build was broken with Qt6 fixes :)

@barracuda156 barracuda156 changed the title ircmessage.cpp: error: 'function' in namespace 'std' does not name a template type (needed header missing) ircmessage.cpp: error: could not convert from '<brace-enclosed initializer list>' to 'const QHash<QString, std::function<IrcMessage*(IrcConnection*)> >' Jun 29, 2023
@barracuda156
Copy link
Author

UPD. This error is not there in 3.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant