Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list #18

Open
yurivict opened this issue Mar 29, 2020 · 1 comment

Comments

@yurivict
Copy link

yurivict commented Mar 29, 2020

http://beefy17.nyi.freebsd.org/data/head-i386-default/p529299_s359382/logs/peaclock-0.4.1.log (IPv6 URL)

clang-8 errors:

/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:86:25: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const now {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:86:25: note: insert an explicit cast to silence this issue
    long int const now {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        static_cast<long>(                                                                   )
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:108:26: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:108:26: note: insert an explicit cast to silence this issue
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         static_cast<long>(                                                                   )
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:120:26: error: non-constant-expression cannot be narrowed from type 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1> >::rep' (aka 'long long') to 'long' in initializer list [-Wc++11-narrowing]
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/deskutils/peaclock/work/peaclock-0.4.1/./src/ob/timer.hh:120:26: note: insert an explicit cast to silence this issue
    long int const diff {std::chrono::time_point_cast<std::chrono::seconds>(_total).time_since_epoch().count()};
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         static_cast<long>(                                                                   )
3 errors generated.
@octobanana
Copy link
Owner

Thanks for letting me know, I appreciate it! It should be fixed with 67b30d7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants