From -5768670798982711618
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b5faa9aaea18095
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-09-26 18:18:28 PST
Path: news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!t-online.de!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: Sat, 27 Sep 2003 01:18:24 +0000 (UTC)
Organization: Faculty of Civil Engineering, Zagreb
Lines: 102
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3F73D9E3.3050504@grad.hr>
References: <4e6fccc6.0309162227.1aa4bda7@posting.google.com> <3F6E975F.8050300@grad.hr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1064625504 18814 10.0.0.1 (27 Sep 2003 01:18:24 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sat, 27 Sep 2003 01:18:24 +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 1A33j4-0004tJ-00
	for mail2news@news.news.demon.net; Sat, 27 Sep 2003 01:18:23 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id LAA01191; Sat, 27 Sep 2003 11:18:19 +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=-4.5 required=5.0
	tests=AWL,BAYES_20,QUOTED_EMAIL_TEXT,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: news1.google.com comp.std.c++:20990


I wrote:

> Joerg Walter wrote:

>> I've already tried to discuss the following two programs on
>> comp.lang.c++.moderated. Kresimir Fresl's test case
[...]
>> is accepted by GCC 3.3.1, a program run results in
[...]
>> 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.

Yesterday I received the following mail from Comeau Computing:
================================================================
================================================================
At 10:39 AM 1/14/2003 +0100, Kresimir Fresl wrote:

> Following program cannot be compiled with
> Comeau C/C++ 4.3.0.1:
> 
> ==========================================
> template <typename A, typename T>
> struct result {};
> 
> template <typename A>
> result<A, typename A::val_t> func (A const& a) {
>    return result<A, typename A::val_t>();
> }
> template <typename R, typename A>
> R func (A const& a) {
>    return R();
> }
> 
> template <typename T>
> struct str1 {
>    typedef T val_t;
> };
> template <typename T>
> struct str2 {
>    typedef T val_t;
> };
> 
> int main() {
>    str1<int> s1;
>    str2<int> s2;
> 
>    func (s1);    // OK
>    func (s2);    // OK
> 
>    func<str1<int> > (s1);   // error1
>    func<str2<int> > (s1);   // OK
>    func<str1<int> > (s2);   // OK
>    func<str2<int> > (s2);   // error2
> }
> ==========================================
> error1: more than one instance of overloaded
>            function "func" matches the argument list:
>              function template "func(const A &)"
>              function template "func<R,A>(const A &)"
>              argument types are: (str1<int>)
>      func<str1<int> > (s1);
> error2: more than one instance of overloaded
>            function "func" matches the argument list:
>              function template "func(const A &)"
>              function template "func<R,A>(const A &)"
>              argument types are: (str2<int>)
>      func<str2<int> > (s2);

Your code is now accepted, and is being put through some regressions.

-------
Comeau C/C++ 4.3.0.1: FULL CORE LANGUAGE, INCLUDING TC1
Comeau C/C++ ONLINE ==>  http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries.  Have you tried it?
comeau@comeaucomputing.com    http://www.comeaucomputing.com
==============================================================

Regards,

Kresimir Fresl


---
[ 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                       ]



