Compile error on conversion of std::time_t to long int
ClosedPublic

Authored by twighk on Oct 5 2019, 9:13 AM.

Details

Summary

Compile error with craft on windows using mingw compiler

C:/CraftRoot/build/_/7971cb53/kgoldrunner-19.08.1/src/kgrgame.cpp:118:56: error: call of overloaded 'KRandomSequence(time_t)' is ambiguous

randomGen = new KRandomSequence (std::time(nullptr));
                                                   ^

In file included from C:/CraftRoot/include/KF5/KCoreAddons/KRandomSequence:1,

from C:/CraftRoot/build/_/7971cb53/kgoldrunner-19.08.1/src/kgrgame.cpp:59:

C:/CraftRoot/include/KF5/KCoreAddons/krandomsequence.h:70:5: note: candidate: 'KRandomSequence::KRandomSequence(const KRandomSequence&)'

KRandomSequence(const KRandomSequence &a);
^~~~~~~~~~~~~~~

C:/CraftRoot/include/KF5/KCoreAddons/krandomsequence.h:60:14: note: candidate: 'KRandomSequence::KRandomSequence(long int)'

explicit KRandomSequence(long lngSeed);
         ^~~~~~~~~~~~~~~

C:/CraftRoot/include/KF5/KCoreAddons/krandomsequence.h:59:14: note: candidate: 'KRandomSequence::KRandomSequence(int)'

explicit KRandomSequence(int intSeed = 0);
         ^~~~~~~~~~~~~~~

Diff Detail

Repository
R396 KGoldrunner
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
twighk created this revision.Oct 5 2019, 9:13 AM
Restricted Application added a subscriber: kde-games-devel. · View Herald TranscriptOct 5 2019, 9:13 AM
twighk requested review of this revision.Oct 5 2019, 9:13 AM
yurchor added a subscriber: yurchor.Oct 5 2019, 9:25 AM

+1

Works fine in Linux.

kgoldrunner-19.08.1/src/kgrgame.cpp
119 ↗(On Diff #67338)

May it be the typo ("sead" -> "seed")?

twighk updated this revision to Diff 67339.Oct 5 2019, 9:28 AM
yurchor accepted this revision.Oct 5 2019, 9:29 AM
This revision is now accepted and ready to land.Oct 5 2019, 9:29 AM
This revision was automatically updated to reflect the committed changes.