From -7032494034170181546
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,a5e7fc89a8659411
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-07-22 11:46:46 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!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: Re: Voided application of indirection operator to pointer-to-void
Date: Tue, 22 Jul 2003 18:46:45 +0000 (UTC)
Organization: http://groups.google.com/
Lines: 48
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <5765b025.0307220144.1df0c5c1@posting.google.com>
References: <5765b025.0307210232.6c571eff@posting.google.com> <slrnbho5vh.18k.do-not-spam-benh@tin.bwsint.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1058899605 24388 10.0.0.1 (22 Jul 2003 18:46:45 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 22 Jul 2003 18:46:45 +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 19f29s-0006L3-00
	for mail2news@news.news.demon.net; Tue, 22 Jul 2003 18:46:44 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id EAA03134; Wed, 23 Jul 2003 04:46:34 +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: 22 Jul 2003 09:44:01 GMT
X-Spam-Status: No, hits=-5.8 required=5.0
	tests=BAYES_01,QUOTED_EMAIL_TEXT,REFERENCES
	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++:20266

do-not-spam-benh@bwsint.com (Ben Hutchings) wrote in message news:<slrnbho5vh.18k.do-not-spam-benh@tin.bwsint.com>...
> In article <5765b025.0307210232.6c571eff@posting.google.com>, Al Grant wrote:
> > and 5.3.1 indicates that those generated by the indirection operator
> > must have an object type.
> 
> Or function type.

Ok, I was forgetting that in C++ function designators are still lvalues.

> > I can believe that the committee might have intended to allow creation
> > of void lvalues, motivated either by orthogonality, or by compatibility
> > with C.
> <snip>
> 
> I very much doubt it; I can't see that it would be meaningful to have a
> void lvalue, and I don't believe C allows it either.

But that's the wrong question.  The question is whether it allows
application of the indirection operator to a pointer-to-void, with
a well defined result, whether or not that result is an lvalue.
Reading 6.5.3.2 suggests this is in fact the case, and the result
is not an lvalue: note the description of the operand of the
unary & operator:
  "either a function designator, the result of a [] or unary *
   operator, or an lvalue that designates an object that is not
   a bit-field and is not declared with the register storage-class
   specifier."
Now this is curious wording if the result of unary * is always
an lvalue/FD.  So it presumably is not.  Reading further in 6.5.3.2
and footnote 83 suggests that the result of *pv is simply a
denotation of indirection - and that &*pv is well-defined and equal
to pv, which implies that *pv is well-defined, though of limited
usefulness.  In particular, not being an lvalue, it is not subject
to the usual void-context (in C) lvalue-to-rvalue conversion.
There appears to be nothing to make it illegal.

Note that the description of unary & is more extensive than in
C89.  In C89 the case of &*pv was considered in DR#12 (and ruled
illegal) and the case of (void)*pv was considered in DR#106 (and
ruled legal).  DR 106 should be sufficient evidence that C++
introduced a compatibility issue for the original code example.

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



