Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Issue with 5.11.1 compile: error: could not convert ‘{listener, data}’ from ‘<brace-enclosed initializer list>’



  • Hi,
    I'm trying to cross-compile 5.11.1 and receiving following error:

    make[4]: Entering directory `/home/piotro/minimyth-dev/script/qt/qt5/work/main.d/qt-everywhere-src-5.11.1/qtmultimedia/src/imports'
    cd multimedia/ && ( test -e Makefile || /home/piotro/minimyth-dev/script/qt/qt5/work/main.d/qt-everywhere-src-5.11.1/qtbase/bin/qmake -o Makefile /home/piotro/minimyth-dev/script/qt/qt5/work/main.d/qt-everywhere-src-5.11.1/qtmultimedia/src/imports/multimedia/multimedia.pro ) && make -f Makefile
    qwaylanddisplay.cpp: In member function ‘void QtWaylandClient::QWaylandDisplay::addRegistryListener(QtWaylandClient::RegistryListener, void*)’:
    qwaylanddisplay.cpp:315:35: error: could not convert ‘{listener, data}’ from ‘<brace-enclosed initialiser list>’ to ‘QtWaylandClient::QWaylandDisplay::Listener’
         Listener l = { listener, data };
    

    Exactly the same build environment allows me to successfully build of 5.10.1 - so issue is IMHO in 5.11.1 sources.
    gcc is 7.3.0 so I don't think issue is about too old compiler.
    It looks I'm not alone with this error as there are posts on stack exchange about this issue - unfortunately without solution...



  • hmm - it looks like relaxing -c++std requirements from c++11 to c++1z allows to compile.
    I think it is 5.11.1 bug.
    pls advise should I fill bug report for this?


  • Lifetime Qt Champion

    Hi,

    5.11.2 is almost out and 5.12 is around the corner, can you check these versions ?



  • @SGaist
    thx for replay.
    sure - i'll give try for 5.11.2.
    is it already aval. as download?
    br


  • Lifetime Qt Champion

    I think that, currently, you have to clone it from https://code.qt.io.



  • I found a solution that worked for me, although there are other issues further into the install. I found the following post on StackOverflow: https://stackoverflow.com/questions/37776823/could-not-convert-from-brace-enclosed-initializer-list-to-struct

    From this, I found that if you go to the struct definitions in the header files and remove the default values, it will compile. Like I said though, I have had other errors in the installation and have not been able to complete the install, so I do not know if these changes affect anything yet.



  • The problem here is that the Listener struct is not an aggregate in C++11, since it has Default Member Initializers (see https://en.wikipedia.org/wiki/C%2B%2B14#Aggregate_member_initialization). This also means that gcc 4.8 doesn't build this code out-of-the-box. I will fix that shortly when I fix a bunch of other gcc 4.8 incompatibilities.


Log in to reply