This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49637] template function overload incorrectly ambiguous


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49637

--- Comment #7 from Timothy J Giese <timothyjgiese at gmail dot com> 2011-07-05 17:34:11 UTC ---
(In reply to comment #5)
> (In reply to comment #1)
> > Created attachment 24686 [details]
> > minimal test case
> 
> IMO this is ambiguous.

> When doing partial ordering, in both cases the 'T'
> remains undeduced.

That's OK; T doesn't need to be deduced, because it is explicitly passed in.
Only the second argument needs to be deduced.

> Recall that partial ordering is, apart from stripping
> parameters that have no corresponding argument in a function call context,
> independent from the context of the ordering. So you cannot take the 'S' that
> you passed explicitly into account. The spec says (FDIS, C++0x)
> 

I interpret "partial ordering" to mean: "the process of choosing which function
to use based on which one is the most specialized".

I interpret your sentence to mean: "the process of choosing which function to
use is independent of how the function is called".  My interpretation feels
weird because it is the specific manner in which the function is called that
the partial ordering process makes its decision, no?


> "In most cases, all template parameters must have values in order for deduction
> to succeed, but for partial ordering purposes a template parameter may remain
> without a value provided it is not used in the types being used for partial
> ordering. [ Note: A template parameter used in a non-deduced context is
> considered used. â end note ]"



"A template parameter used in a non-deduced context is considered used."

To me means:
T is being used in a non-deduced context, so it is being "used"; therefore,
it's template parameter must be specified in order to achieve partial ordering.


"...for partial ordering purposes a template parameter may remain
without a value provided it is not used in the types being used for partial
ordering."

To me means:
...for partial ordering purposes [the second template argument] may remain
without a value provided it is not [the "thingie" that determines the level of
specialization.]

ACK!
So, I think my interpretation here is in agreement with your conclusion.

However, this conclusion had nothing to do with the fact that T was being used
in a non-deductible context, right?  It had to do with the second argument.

Therefore, shouldn't the small test code in Comment #3 fail?
The second template argument is left without a value, but it's value is used to
determine the level of specialization in the partial ordering process.

Or more generally: You can't overload a template function without providing all
of the template parameters, because the unspecified parameters cannot be used
to determine the partial ordering.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]