| 1 |
#include <QtCore/QList> |
| 2 |
#include <QtCore/QMap> |
| 3 |
#include <QtCore/QMultiMap> |
| 4 |
|
| 5 |
QList<int> getList() {return {};} |
| 6 |
|
| 7 |
void test() |
| 8 |
{ |
| 9 |
QList<int> list; |
| 10 |
if (!list.isEmpty()) {} // Warning |
| 11 |
if (list.isEmpty()) {} // Warning |
| 12 |
bool b1 = !list.isEmpty(); // Warning |
| 13 |
bool b2 = !list.isEmpty(); // Warning |
| 14 |
if (list.indexOf(1)) {} // OK |
| 15 |
|
| 16 |
QMap<int, int> map; |
| 17 |
if (!map.isEmpty()) {} // Warning |
| 18 |
if (map.contains(2)) {} // Warning |
| 19 |
|
| 20 |
QMultiMap<int, int> multiMap; |
| 21 |
if (!multiMap.isEmpty()) {} // Warning |
| 22 |
if (multiMap.contains(2)) {} // Warning |
| 23 |
if (multiMap.contains(2)) {} // Warning |
| 24 |
|
| 25 |
if (!getList().isEmpty()) {} // Warning |
| 26 |
} |
| 27 |
|
| 28 |
void testExplicitConversion() |
| 29 |
{ |
| 30 |
if (getList().isEmpty()) {} // Warning |
| 31 |
if (getList().isEmpty()) {} // Warning |
| 32 |
if (!getList().isEmpty()) {} // Warning |
| 33 |
const bool myCheck = !getList().isEmpty(); |
| 34 |
} |