From 7168024722267201467
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,a5e7fc89a8659411,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-07-21 08:06:55 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: algrant@myrealbox.com (Al Grant)
Newsgroups: comp.std.c++
Subject: Voided application of indirection operator to pointer-to-void
Date: Mon, 21 Jul 2003 15:06:55 +0000 (UTC)
Organization: http://groups.google.com/
Lines: 33
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <5765b025.0307210232.6c571eff@posting.google.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1058800015 11155 10.0.0.1 (21 Jul 2003 15:06:55 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 21 Jul 2003 15:06:55 +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 19ecFZ-0002tm-00
	for mail2news@news.news.demon.net; Mon, 21 Jul 2003 15:06:53 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id BAA03574; Tue, 22 Jul 2003 01:06: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-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: 21 Jul 2003 10:32:49 GMT
X-Spam-Status: No, hits=-5.4 required=5.0
	tests=BAYES_01
	version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Xref: archiver1.google.com comp.std.c++:20237

Is this legal C++?

  void f(void *pv) { *pv; }

Comeau and g++ both fault it.  5.3.1 says the operand of * must be T*
where T is an object type or function type - so not void.  A note then
says T may be incomplete but that does not contradict the preceding,
as long as it's an incomplete object type.  This is motivated by
binding references to objects of incomplete type.  The note explicitly
(and redundantly) excludes void.

However, we have another source claiming the code is legal, citing 4.1
as showing an intention to allow (undereferenced) lvalues of incomplete
type and deducing that if 5.3.1 forbids this it is an oversight.

It seems to me that 4.1 only implies that lvalues of some incomplete
types may exist, and 5.3.1 indicates that those generated by the
indirection operator must have an object type.  I can believe that
the committee might have intended to allow creation of void lvalues,
motivated either by orthogonality, or by compatibility with C.
But the resulting standard seems neither self-contradictory
nor obviously broken, so it is not clear there is a defect here.

I think this could still benefit from raising a core language issue -
this would be an opportunity to make the construct legal, if that was
the original intention.

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



