Skip to content

Warnings C4244 and C4305 'argument': truncation / conversion from 'double' to 'RawType' / 'const M' to 'const Element' #949

Closed

Description

@Andreas-Schniertshauer

compiled with Visual Studio 2019 Professional 16.5.1 on windows 10 1903.

`\src\benchmark_runner.cc(267,13): warning C4244: 'initializing': conversion from 'double' to 'benchmark::IterationCount', possible loss of data
\src\benchmark_runner.cc(266,41): warning C4244: 'initializing': conversion from 'double' to 'const benchmark::IterationCount', possible loss of data
\test\statistics_gtest.cc(25,1): warning C4305: 'argument': truncation from 'double' to 'RawType' \test\statistics_gtest.cc(24,1): warning C4244: 'argument': conversion from 'double' to 'RawType', possible loss of data
\test../src/benchmark_register.h(25,1): warning C4244: '*=': conversion from 'int' to 'T', possible loss of data
\src\googlemock\include\gmock/gmock-matchers.h(368,12): warning C4244: 'argument': conversion from 'const M' to 'const Element', possible loss of data

Activity

  1. benvanik commented on Mar 27, 2020

    @benvanik

    These would be great to fix - since benchmark overrides default warnings and forces these on it should be warning clean:

    benchmark/CMakeLists.txt

    Lines 103 to 104 in e30cac6

    string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")

  2. dmah42 commented on Mar 30, 2020

    @dmah42
    Member

    Agreed. It used to be (sigh).

    I'll take a look.

  3. self-assigned this
    on Mar 30, 2020
  4. added a commit that references this issue on Mar 30, 2020
    a16b2e0
  5. added a commit that references this issue on Apr 6, 2020
    0ab2c29
  6. LebedevRI commented on Apr 6, 2020

    @LebedevRI
    Collaborator

    Why didn't CI fail with that warning?
    Is warning-as-error not enabled for that compiler?
    Edit: because that compiler isn't being tested i guess.

  7. added a commit that references this issue on Sep 11, 2020
    13aaf39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions