1 #include <QtCore/QList> 2 3 4 5 6 7 8 9 10 11 12 struct SmallType { 13 char a[sizeof(void*)]; 14 }; 15 16 17 struct BigType { 18 char a[9]; 19 }; 20 21 foo()22void foo() 23 { 24 QList<BigType> bigT; // Warning 25 QList<SmallType> smallT; // OK 26 } 27 28 class A { 29 public: foo()30 void foo() 31 { 32 m_big.clear(); 33 } 34 35 QList<BigType> m_big; // OK 36 }; 37 foo1(QList<BigType> big2)38void foo1(QList<BigType> big2) 39 { 40 QList<BigType> bigt; // OK 41 bigt = big2; 42 } 43 foo2()44QList<BigType> foo2() 45 { 46 QList<BigType> bigt; // OK 47 return bigt; 48 } 49 50 static QList<BigType> s_big; 51 extern void takesBig(QList<BigType>); foo3()52void foo3() 53 { 54 QList<BigType> bigt; // OK 55 s_big = bigt; 56 s_big = QList<BigType>(); // OK 57 58 QList<BigType> bigt2; // OK 59 takesBig(bigt2); 60 } 61 extern QList<BigType> returnsBig(); foo4()62void foo4() 63 { 64 QList<BigType> b; // Warning 65 for (auto a : b) {} 66 67 QList<BigType> b2 = returnsBig(); // OK 68 QList<BigType> b3 = { BigType() }; // Warning 69 QList<BigType> b4 = b2; // Ok 70 } 71 72 struct A1 73 { 74 QList<BigType> a(); 75 }; 76 77 struct B1 78 { 79 A1 b(); 80 }; 81 foo5()82void foo5() 83 { 84 QList<BigType> b5 = B1().b().a(); 85 } 86 test_bug358740()87void test_bug358740() 88 { 89 QList<int> list; // OK 90 int a, b; 91 } 92