Skip to content

compilation failure with large duration ratios #1154

@pauldreik

Description

@pauldreik

Hi,
the following fails to compile with the recent fixes inside chrono (the milliseconds handling), which broke compilation of the chrono fuzzer.

TEST(ChronoTest, StdChronoCompiletimeOverflowCheckLarge) {
  // this wont compile, fails on the internal overflow check                                                                                      
  // in std::ratio for libstdc++ (gnu)                                                                                                            
  using Large = std::chrono::duration<float, std::exa>;
  EXPECT_TRUE("" != fmt::format("{}", Large{1}));
}

TEST(ChronoTest, StdChronoCompiletimeOverflowCheckSmall) {
  // this works fine                                                                                                                              
  using Small = std::chrono::duration<float, std::atto>;
  EXPECT_TRUE("" != fmt::format("{}", Small{1}));
}

I am not sure what is the best route forward - it would be nice if all the standard prefixes are supported (peta works, it is only exa that doesn't).
If anyone actually uses exaseconds as their unit, it would be very interesting to hear what problem and/or domain they work with :-)

Metadata

Metadata

Assignees

No one assigned

    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