Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22097

QVector::contains fails with checks against constants

$
0
0

Environment as stated in the tags too:

GCC 64bit, Qt 5.12

I have the following example code:

// test.h#include <QVector>class Test {    Test();    // Same results with QSet    const QVector<int> things = {        BANANA,        RASPBERRY,        APPLE,        -2500,    };    const int BANANA = -1000;    const int RASPBERRY = -2000;    const int APPLE = -3000;};
// test.cpp#include <QDebug>#include "test.h"Test::Test(){    qDebug() << things.contains(APPLE); // false, expected true    qDebug() << things.contains(-3000); // false, expected true    qDebug() << things.contains(-2500); // true, expected true}

I don't understand if I've done something wrong in the definitions or I encountered a bug in Qt.


Viewing all articles
Browse latest Browse all 22097


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>