blob: b2c2aaf1a0f00c9a2e3b8d61b4cda4e07a82483d [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify
Chris Lattner9a11b9a2007-10-19 20:10:30 +00002
3void test() {
Chris Lattner1f6f54b2008-11-11 06:13:16 +00004 char = 4; // expected-error {{expected identifier}}
Chris Lattner9a11b9a2007-10-19 20:10:30 +00005}
6
7
Chris Lattner8389eab2008-08-09 21:35:13 +00008// PR2400
Douglas Gregor58408bc2010-01-11 18:46:21 +00009typedef xtype (*x)(void* handle); // expected-error {{function cannot return function type}} expected-warning {{type specifier missing, defaults to 'int'}} expected-warning {{type specifier missing, defaults to 'int'}}
Chris Lattnereaaebc72009-04-25 08:06:05 +000010
11typedef void ytype();
12
Chris Lattner8389eab2008-08-09 21:35:13 +000013
14typedef struct _zend_module_entry zend_module_entry;
15struct _zend_module_entry {
Chris Lattnereaaebc72009-04-25 08:06:05 +000016 ytype globals_size; // expected-error {{field 'globals_size' declared as a function}}
Chris Lattner8389eab2008-08-09 21:35:13 +000017};
18
19zend_module_entry openssl_module_entry = {
20 sizeof(zend_module_entry)
21};
22
Eli Friedman06808f12012-08-08 04:39:56 +000023// <rdar://problem/11067144>
24typedef int (FunctionType)(int *value);
25typedef struct {
26 UndefinedType undef; // expected-error {{unknown type name 'UndefinedType'}}
27 FunctionType fun; // expected-error {{field 'fun' declared as a function}}
28} StructType;
29void f(StructType *buf) {
30 buf->fun = 0;
31}
Fariborz Jahanian37c765a2012-09-05 17:52:12 +000032
33// rdar://11743706
34static void bar(hid_t, char); // expected-error {{expected identifier}}
35
36static void bar(hid_t p, char); // expected-error {{unknown type name 'hid_t'}}
37
38void foo() {
39 (void)bar;
40}