From -231768239834600301
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,bb2cedb5166b3859
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-11-12 16:57:01 PST
Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: Typeof considered harmful (long)
Date: Tue, 13 Nov 2001 00:56:18 GMT
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <memo.20011112225724.3923D@brangdon.madasafish.com>
References: <fTlH7.2855$c87.79835@ozemail.com.au>
Reply-To: brangdon@cix.co.uk
X-Trace: mail2news.demon.co.uk 1005612982 mail2news:7389 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Orig-NNTP-Posting-Host: host213-120-5-24.webport.bt.net (213.120.5.24)
X-Orig-X-Trace: fu-berlin.de 1005605831 38547412 213.120.5.24 (16 [57443])
Lines: 50
Xref: archiver1.google.com comp.std.c++:8139

brianjparker@ozemail.com.au (Brian Parker) wrote (abridged):
> A solution, then is to specify that after function argument
> deduction, if function template parameters remain non-deduced and
> are not used as part of the function signature (excluding
> the return type), then the type is deduced to be that of the 
> initializing expression (or more accurately, it is deduced by the
> same algorithm that a function parameter is deduced to match
> an initialising function argument).

Interesting idea.

What happens with recursive loops?

    export template <typename R, typename P1>
    R func2( P1 p1 );
    
    export template <typename R, typename P1>
    R func1( P1 p1 ) {
        return func2( p1 );
    }

    export template <typename R, typename P1>
    R func2( P1 p1 ) {
        return func1( p1 );
    }

What is the type of func1(1)? Is the compiler required to give a 
diagnostic? If so, when?

What happens with "export"? The standard says in $14.8:

   [Note: an implementation may require that a translation unit
   containing the definition of an exported template be compiled
   before any translation unit containing an instantiation of
   that template.]

When is the definition of func1() complete? May the compiler require to 
see the definition of func2() before func1() can be instantiated?

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      brangdon@cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."

---
[ 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.research.att.com/~austern/csc/faq.html                ]



