| Summary: | -std=c++17 mask connect-3arg-lambda check | ||
|---|---|---|---|
| Product: | [Developer tools] clazy | Reporter: | Evgeniy A. Dushistov <dushistov> |
| Component: | general | Assignee: | Unassigned bugs <unassigned-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | smartins |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/sdk/clazy/commit/2d3e842961b9d52e454c2c6838a30c630ba91492 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Evgeniy A. Dushistov
2021-05-04 23:38:11 UTC
Looks like this is expected behavior of clang/libclang:
for code like this:
#define signals public
class QObject {
signals:
void destroyed();
public:
template<typename F>
static void connect(QObject *, void (QObject::*mf)(void), F f) {}
void deleteLater();
};
void test(QObject *o1, QObject *o2)
{
QObject::connect(o1, &QObject::destroyed,
[=] { o2->deleteLater(); });
}
clang dumps different AST.
In case of -std=c++14 (clang++ -std=c++14 -Xclang -ast-dump -c test.cpp)
3rd argument (lambda) passed to QObject::connect looks like this:
CXXConstructExpr 0x5589e3278970 <line:14:21, col:46> '(lambda at test.cpp:14:21)':'(lambda at test.cpp:14:21)' 'void ((lambda at test.cpp:14:21) &&) noexcept' elidable
`-MaterializeTemporaryExpr 0x5589e3275cd0 <col:21, col:46> '(lambda at test.cpp:14:21)' xvalue
`-LambdaExpr
in case of -std=c++17 lambda looks like this:
`-LambdaExpr 0x5641f55db880 <line:14:21, col:46> '(lambda at test.cpp:14:21)'
|-CXXRecordDecl 0x5641f55db420 <col:21> col:21 implicit class definition
Git commit bf9c81e8dda41c4a1202c93dbf85c4afef361ec2 by Sergio Martins. Committed on 05/05/2021 at 13:40. Pushed by smartins into branch 'master'. tests: Allow a test to specify that it wants c++17 M +12 -7 tests/run_tests.py https://invent.kde.org/sdk/clazy/commit/bf9c81e8dda41c4a1202c93dbf85c4afef361ec2 Git commit 2d3e842961b9d52e454c2c6838a30c630ba91492 by Sergio Martins. Committed on 05/05/2021 at 14:07. Pushed by smartins into branch 'master'. connect-3arg-lambda: Add a test that it still works with c++17 M +5 -0 tests/connect-3arg-lambda/config.json https://invent.kde.org/sdk/clazy/commit/2d3e842961b9d52e454c2c6838a30c630ba91492 |