[cfe-dev] 'const void' is considered to be an incomplete type by clang 3.5.0

Stephen Canon scanon at apple.com
Mon Apr 21 14:27:21 PDT 2014


On Apr 21, 2014, at 5:18 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Mon, Apr 21, 2014 at 12:21 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> ----- Original Message -----
> > From: "Yuri" <yuri at rawbw.com>
> > To: "Hal Finkel" <hfinkel at anl.gov>
> > Cc: cfe-dev at cs.uiuc.edu
> > Sent: Monday, April 21, 2014 2:16:16 PM
> > Subject: Re: [cfe-dev] 'const void' is considered to be an incomplete type by clang 3.5.0
> >
> > On 04/21/2014 12:07, Hal Finkel wrote:
> > > What do you mean? As I understand it, void is always incomplete.
> > > What do you expect sizeof(const void) to return?
> >
> > 'incomplete' implies that it can be completed, and 'const void' can't
> > be
> > completed.
> 
> Perhaps, but 'incomplete' here is the correct technical term. 3.9.1 says, "The void type is an incomplete type that cannot be completed.".
> 
> > So there are two different situations and this message
> > doesn't differentiate between them.
> > The message should say "can't apply 'sizeof' to 'const void'" to be
> > more
> > clear.
> >
> > Curiously, clang-3.3 thought that sizeof(const void) is 1.
> 
> Interesting.
> 
> Hmm, maybe this was the GNU 'arithmetic on void pointers' extension leaking through?

The gnu arithmetic on void pointers extension explicitly says sizeof(void) == 1, no leaking required.

	http://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140421/7ca0ddbc/attachment.html>


More information about the cfe-dev mailing list