From 5157416585490161697
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c42fc9ad8a4a8a45
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-01-21 22:54:45 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: rani_sharoni@hotmail.com ("Rani Sharoni")
Newsgroups: comp.std.c++
Subject: Re: Lookup for operators in expressions 13.3.1.2
Date: Wed, 22 Jan 2003 06:54:42 +0000 (UTC)
Lines: 60
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3e2db167@news.microsoft.com>
References: <pprj2vgjdu35kj1bfi37fcld1p6h5fakbo@4ax.com> <86fzrnl8yj.fsf@Zorthluthik.foo> <fbtp2vg13aabiknfdlstg23ed932dv0hfu@4ax.com>
X-Trace: mail2news.demon.co.uk 1043218482 8520 10.0.0.1 (22 Jan 2003 06:54:42 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 22 Jan 2003 06:54:42 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18bEmW-0002DH-00
	for mail2news@news.news.demon.net; Wed, 22 Jan 2003 06:54:41 +0000
X-Received: by mulga.cs.mu.OZ.AU
	id RAA04729; Wed, 22 Jan 2003 17:54:35 +1100 (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++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Original-NNTP-Posting-Host: 172.27.67.48
X-OriginalArrivalTime: 21 Jan 2003 20:45:51.0288 (UTC) FILETIME=[15AB9B80:01C2C18E]
X-Spam-Status: No, hits=-2.4 required=5.0
	tests=FORGED_HOTMAIL_RCVD,PRIORITY_NO_NAME,QUOTED_EMAIL_TEXT,
	      REFERENCES,SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:17375


"Graeme Prentice" <gp1@paradise.net.nz> wrote in message
news:fbtp2vg13aabiknfdlstg23ed932dv0hfu@4ax.com...
> [...]
> I'm not sure I understand you.  If the class definition is not visible
> then it's an incomplete type so can't be looked up in the scope of the
> class.  For the following code, the Borland compiler gives a compile
> time error (undefined structure c1),  Comeau 4.3.0.1 gives a
> catastrophic failure (seems to be a problem in the Borland backend, so
> the "front end" probably thinks it's valid) and GCC 3.2 compiles with no
> errors.  If this code is intended to be valid, I think 13.3.1.2 should
> say that if the class T1 is an incomplete type then the set of member
> candidates is empty  - or else it should say that T1 must be a complete
> type.  The way 13.3.1.2  is currently written leaves it open to
> interpretation IMO.  Since some compilers treat it as valid code, it's
> probably best to allow an incomplete type, to avoid breaking existing
> code, if nothing else.
>
> class c1;
> extern c1 o1;
> void operator<<( c1&, int );
>
> int main()
> {
>     o1 << 23;
> }
>
I thought that the C++ standard should say that in contexts in which
incomplete type is involved the program should not change its meaning if the
type was complete but I found no evidence for such rule although it seems to
be in the spirit of the ODR.
For example:
struct B {};
struct D;

int f(void *);
int f(B*);

D *dp;
int  x1 = f(dp); // selects f(void*)

struct D : B {};
int x2 = f(dp);  // oops - selects f(B*);

In general, lookup might be change when type becomes complete.
I found few places where the rule I mentioned is explicitly specified, For
example:
5.3.1/4 - classes that declares operator&()
14.3.3/2 - visibility of partial specialization (another form of
completeness)

Rani


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



