[cfe-dev] Semantics for dereferencing incomplete types?

Eli Friedman eli.friedman at gmail.com
Sun Jan 13 03:25:39 PST 2008


On Jan 12, 2008 11:14 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> Take the following two testcases:
>
> void
> foo (void)
> {
>   struct b;
>   struct b* x = 0;
>   struct b* y = &*x;
> }
>
> void foo2 (void)
> {
>   typedef int (*arrayptr)[];
>   arrayptr x = 0;
>   arrayptr y = &*x;
> }
>
> Currently, clang rejects both of these.
> Here is another test:
> void foo3 (void)
> {
>   void* x = 0;
>   void* y = &*x;
> }

Attached is a patch which makes all of these testcases work correctly
(as far as I can tell).  Essentially, this just removes the error for
a completely legal construct and fixes up the void* case to work per
C99.

-Eli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixderef.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080113/dd4c1a61/attachment.txt>


More information about the cfe-dev mailing list