2009-12-16 04:14:24 +08:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
2009-02-02 23:00:55 +08:00
// PR3459
struct bar {
2009-09-09 23:08:12 +08:00
char n [ 1 ] ;
2009-02-02 23:00:55 +08:00
} ;
struct foo {
2009-09-09 23:08:12 +08:00
char name [ ( int ) & ( ( struct bar * ) 0 ) - > n ] ;
2011-06-14 14:38:10 +08:00
char name2 [ ( int ) & ( ( struct bar * ) 0 ) - > n - 1 ] ; //expected-error{{'name2' declared as an array with a negative size}}
2009-02-02 23:00:55 +08:00
} ;
2009-02-03 08:34:39 +08:00
// PR3430
struct s {
2009-09-09 23:08:12 +08:00
struct st {
int v ;
} * ts ;
2009-02-03 08:34:39 +08:00
} ;
struct st ;
int foo ( ) {
2009-09-09 23:08:12 +08:00
struct st * f ;
return f - > v + f [ 0 ] . v ;
2009-02-03 08:34:39 +08:00
}
2009-02-22 08:20:44 +08:00
2009-03-07 07:41:27 +08:00
// PR3642, PR3671
2009-02-22 08:20:44 +08:00
struct pppoe_tag {
short tag_type ;
char tag_data [ ] ;
} ;
struct datatag {
2009-09-09 23:08:12 +08:00
struct pppoe_tag hdr ; //expected-warning{{field 'hdr' with variable sized type 'struct pppoe_tag' not at the end of a struct or class is a GNU extension}}
char data ;
2009-02-22 08:20:44 +08:00
} ;
2009-04-29 13:12:23 +08:00
// PR4092
struct s0 {
char a ; // expected-note {{previous declaration is here}}
char a ; // expected-error {{duplicate member 'a'}}
} ;
struct s0 f0 ( void ) { }
2010-07-13 01:35:39 +08:00
// <rdar://problem/8177927> - This previously triggered an assertion failure.
struct x0 {
unsigned int x1 ;
} ;
2011-03-23 07:00:04 +08:00
// rdar://problem/9150338
static struct test1 { // expected-warning {{'static' ignored on this declaration}}
int x ;
} ;
const struct test2 { // expected-warning {{'const' ignored on this declaration}}
int x ;
} ;
inline struct test3 { // expected-warning {{'inline' ignored on this declaration}}
int x ;
} ;