Bug 44257 - typeof(*(struct undefined *)) fails to compile
Summary: typeof(*(struct undefined *)) fails to compile
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-24 00:29 UTC by rusty
Modified: 2010-05-24 00:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rusty 2010-05-24 00:29:46 UTC
struct foo; 
typeof(struct foo) *p; // This is fine.
typeof(*p) *p2; // foo.c:5: error: dereferencing pointer to incomplete type

This is important, because AFAICT the only way to declare a const pointer for a given type is: "const typeof(*p) *" which doesn't work if p is a pointer to an undefined struct :(