Results 1 to 3 of 3

Thread: Using shift operator in enums not working

  1. #1
    Join Date
    Mar 2011
    Posts
    25
    Thanks
    7
    Qt products
    Qt4

    Default Using shift operator in enums not working

    this kind of code worked fine in Qt 5.4 but doesn't compile in 5.5. Is that a bug or is there a reason that this isn't supposed to work?
    I get an error: qt_getEnumMetaObject: none of the 5 overloads could convert all the argument types

    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QDebug>
    3.  
    4. enum {
    5. test1 = 0
    6. };
    7.  
    8. enum {
    9. sun = (1 << test1)
    10. };
    11.  
    12. enum {
    13. bla = (1 << sun)
    14. };
    15. int main(int argc, char *argv[])
    16. {
    17. QCoreApplication a(argc, argv);
    18. qDebug() << "test";
    19. return a.exec();
    20. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using shift operator in enums not working

    That doesn't look Qt related at all.

    Do you still get the problem if you have an empty main()?

    Cheers,
    _

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Using shift operator in enums not working

    The error looks Qt-related, but it almost certainly has nothing to do with the code that was posted.

Similar Threads

  1. [ubuntu] [enums] enums error: does not name a type
    By amreo in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2015, 15:43
  2. How to use enums in qml
    By nightroad in forum Qt Quick
    Replies: 0
    Last Post: 29th June 2011, 14:24
  3. Replies: 2
    Last Post: 22nd December 2010, 11:37
  4. Indirection operator not working from QProcess
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2010, 15:06
  5. how to use enums
    By soul_rebel in forum General Programming
    Replies: 3
    Last Post: 23rd March 2006, 22:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.