Hello George,
Cint checks parameter matches from exact match to user conversion
all together with all the arguments. In this case,
TPhCalKey("String","String",100)
Cint searches in following order
TPhCalKey(char*,char*,int)
template<class T,E> TPhCalKey(T,T,E)
TPhCalKey(char*,char*,(any integral type))
TPhCalKey(void*,void*,(any numerical type))
TPhCalKey(anyUserConv(char*),anyUserConv(char*),anyUserConv(int))
In this case, because all 3 parameters matched with user defined conversion
before it sees the true candidate. This behavior is not fully compliant to
the standard , but speeds up overloading resolution in interpreter
environment. Please understand the speed advantage and stand with current
implementation.
About explicit keyword, cint supports it only with interpreted functions.
I made a change so that this feature is also used for precompiled functions.
>From 5.14.34, you can use explicit keyword to avoid this kind of problem.
Thank you
Masaharu Goto
>
>Rooters,
>
>I just ran into this problem again:
>
>I have an object with two constructors. One takes
>TPhCalKey(const TString &, const TString &, TDatime)
>
>and the other takes:
>TPhCalKey(const TString &, const TString &, Int)
>
>If in CINT, I try to call this function with
>
>TPhCalKey("String","String2",100)
>
>it calls the first constructor, implicitly making a TDatime from an
>Int.
>
>All compilers I have used report no ambiguity and resolve to the second
>function.
>
>I realize that I can kludge around this by fixing the order of
>declaration of the constructors, but I think this really ought to be
>fixed in CINT. I know it's not a perfect ANSI interpreter, but proper
>intuitive overload resolution is something that people expect to just
>work, and when it doesn't, it can cause subtle, hard-to-find and
>hard-to-fix bugs.
>
>I also think that, at least on compilers conforming to the standard and
>having the 'explicit' keyword, the TDatime constructor from an Int
>ought to be declared as 'explicit'. Does CINT understand the explicit
>keyword? If it did, this would also have fixed my particular problem...
>
>George Heintzelman
>gah@bnl.gov
>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET