Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT 5.12.0 qtestcase.h(418) Warrning C4805

QT 5.12.0 qtestcase.h(418) Warrning C4805

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 605 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Maciek0M Offline
    Maciek0M Offline
    Maciek0
    wrote on last edited by
    #1

    In this part i have warrning:

    E:\QT\5.12.0\msvc2017\include\QtTest\qtestcase.h(418): warning C4805: '==': unsafe mix of type 'const T1' and type 'const T2' in operation
    1> with
    1> [
    1> T1=bool
    1> ]
    1> and
    1> [
    1> T2=int
    1> ] (compiling source file Tests.cpp)
    1>C:\Users\M91P\source\repos\Newmen_Style\newmen_prices_calc\newmen_prices_calc\Tests.cpp(32): note: see reference to function template instantiation 'bool QTest::qCompare<bool,int>(const T1 &,const T2 &,const char *,const char *,const char *,int)' being compiled
    1> with
    1> [
    1> T1=bool,
    1> T2=int
    1> ]

    Can i fix this with:

    template <typename T1, typename T2>
    inline bool qCompare(const T1 &t1, const T2 &t2, const char *actual, const char *expected,
    const char *file, int line)
    {
    return compare_helper(t1 == static_cast<T1>(t2), "Compared values are not the same",
    toString(t1), toString(t2), actual, expected, file, line);
    }

    ??

    Thank You for answer.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What code is triggering that warning ?

      And the answer is no, you are currently comparing two different things so if there's something you should change it's not the testing framework as it is complaining for the right reason.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Maciek0M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        What code is triggering that warning ?

        And the answer is no, you are currently comparing two different things so if there's something you should change it's not the testing framework as it is complaining for the right reason.

        Maciek0M Offline
        Maciek0M Offline
        Maciek0
        wrote on last edited by
        #3

        @SGaist said in QT 5.12.0 qtestcase.h(418) Warrning C4805:

        Hi,

        What code is triggering that warning ?

        And the answer is no, you are currently comparing two different things so if there's something you should change it's not the testing framework as it is complaining for the right reason.

        Fixed, my fault, il compare bool with int.

        SGaistS 1 Reply Last reply
        0
        • Maciek0M Maciek0

          @SGaist said in QT 5.12.0 qtestcase.h(418) Warrning C4805:

          Hi,

          What code is triggering that warning ?

          And the answer is no, you are currently comparing two different things so if there's something you should change it's not the testing framework as it is complaining for the right reason.

          Fixed, my fault, il compare bool with int.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Maciek0 said in QT 5.12.0 qtestcase.h(418) Warrning C4805:

          @SGaist said in QT 5.12.0 qtestcase.h(418) Warrning C4805:

          Hi,

          What code is triggering that warning ?

          And the answer is no, you are currently comparing two different things so if there's something you should change it's not the testing framework as it is complaining for the right reason.

          Fixed, my fault, il compare bool with int.

          Great !

          Since you have it working now, please mark the thread as solved using the "Topic Tools" button so other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved