From -922231118559612097
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b5faa9aaea18095
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-09-22 10:05:01 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: fresl@grad.hr (Kresimir Fresl)
Newsgroups: comp.std.c++
Subject: Re: Problem with function template overload resolution
Date: Mon, 22 Sep 2003 17:05:00 +0000 (UTC)
Organization: Faculty of Civil Engineering, Zagreb
Lines: 85
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3F6E975F.8050300@grad.hr>
References: <4e6fccc6.0309162227.1aa4bda7@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1064250300 19512 10.0.0.1 (22 Sep 2003 17:05:00 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 22 Sep 2003 17:05:00 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1A1U7O-00054Z-00
	for mail2news@news.news.demon.net; Mon, 22 Sep 2003 17:04:59 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id DAA06121; Tue, 23 Sep 2003 03:04:50 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826
X-Accept-Language: en-us, en
X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at master.grad.hr
X-Spam-Status: No, hits=-5.9 required=5.0
	tests=BAYES_01,EMAIL_ATTRIBUTION,REFERENCES,USER_AGENT_MOZILLA_UA
	version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
X-Newsgroups: comp.std.c++
Xref: archiver1.google.com comp.std.c++:20828


Joerg Walter wrote:

> I've already tried to discuss the following two programs on
> comp.lang.c++.moderated. Kresimir Fresl's test case
> 
> ----------
> #include <iostream>
> 
> template<typename A, typename T>
> struct result {};
> 
> template<typename T>
> struct arg1 {
>    typedef T value_type;
> };
> template<typename T>
> struct arg2 {
>    typedef T value_type;
> };
> 
> template<typename A>
> result<A, typename A::value_type> foo(A const& a) {
>    std::cout << "foo<A>" << std::endl;
>    return result<A, typename A::value_type>();
> }
> template<typename R, typename A>
> R foo(A const& a) {
>    std::cout << "foo<R, A>" << std::endl;
>    return R();
> }
> 
> int main() {
>    arg1<int> s1;
>    arg2<int> s2;
> 
>    foo(s2);    // OK
> 
>    foo<arg1<int>, arg2<int> >(s2);  // OK
>    foo<arg2<int>, arg2<int> >(s2);  // OK
> 
>    foo<arg1<int> >(s2);    // OK
>    foo<arg2<int> >(s2);    // Ambigous?
> }
> 
> ----------
> 
> is accepted by GCC 3.3.1, a program run results in
> 
> foo<A>
> foo<R, A>
> foo<R, A>
> foo<R, A>
> foo<R, A>
> 
> ICC 7.1 and MSVC 7.1 reject this code. 

And Comeau C/C++ 4.3.0.1, too.

Some time ago (in January) I asked Comeau's support team about
it. Here is their reply:
================================================================
[...] We suspect your case
is ill-formed but still need to go through that Standard more
thoroughly on it before saying so for certain, and we also want
to double check it is not impacted by any pending defect report.
================================================================

But they never said `so for certain', and, if `so', why.

Regards,

Kresimir Fresl


PS. I also tried 4.3.3 beta online:

    http://www.comeaucomputing.com/tryitout/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



