2009-12-15 20:14:24 +00:00
|
|
|
/* RUN: %clang_cc1 -fsyntax-only -verify -std=c90 -pedantic %s
|
2009-05-03 22:36:05 +00:00
|
|
|
*/
|
2008-01-13 17:10:08 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
void foo3 (void)
|
|
|
|
{
|
|
|
|
void* x = 0;
|
2022-09-24 22:18:04 +08:00
|
|
|
void* y = &*x; /* expected-warning{{address of an expression of type 'void'}}
|
|
|
|
expected-warning {{ISO C does not allow indirection on operand of type 'void *'}} */
|
2008-02-10 00:30:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern const void cv1;
|
2008-02-18 15:14:59 +00:00
|
|
|
|
2008-02-10 00:30:18 +00:00
|
|
|
const void *foo4 (void)
|
|
|
|
{
|
|
|
|
return &cv1;
|
2008-01-13 17:10:08 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 01:39:04 +00:00
|
|
|
extern void cv2;
|
|
|
|
void *foo5 (void)
|
|
|
|
{
|
2009-05-03 22:36:05 +00:00
|
|
|
return &cv2; /* expected-warning{{address of an expression of type 'void'}} */
|
2008-02-10 01:39:04 +00:00
|
|
|
}
|
2008-02-18 15:14:59 +00:00
|
|
|
|
|
|
|
typedef const void CVT;
|
|
|
|
extern CVT cv3;
|
|
|
|
|
|
|
|
const void *foo6 (void)
|
|
|
|
{
|
|
|
|
return &cv3;
|
|
|
|
}
|
|
|
|
|