// storage-class specifier or with the storage-class specifier "static",
// constitutes a tentative definition. Note: A tentative definition with
// external linkage is valid (C99 6.2.2p5).
- if (FVD && !FVD->getInit() && FVD->getStorageClass() == VarDecl::Static) {
+ if (FVD && !FVD->getInit() && (FVD->getStorageClass() == VarDecl::Static ||
+ FVD->getStorageClass() == VarDecl::None)) {
// C99 6.9.2p3: If the declaration of an identifier for an object is
// a tentative definition and has internal linkage (C99 6.2.2p3), the
// declared type shall not be an incomplete type.
return a;
}
-int foo[](void); // expected-error {{'foo' declared as array of functions}}
+int foo[](void); // expected-error {{variable has incomplete type 'int (*[])(void)'}} expected-error {{'foo' declared as array of functions}}
+int foo2[1](void); // expected-error {{'foo2' declared as array of functions}}
typedef int (*pfunc)(void);
void foo3 (void)
{
void* x = 0;
- void* y = &*x; // expected-error {{invalid lvalue in address expression}}
+ void* y = &*x; // expected-error {{address expression must be an lvalue or a function designator}}
}
return sizeof(enum e) ;
}
-enum gccForwardEnumExtension ve; // expected-warning {{ISO C forbids forward references to 'enum' types}}
+enum gccForwardEnumExtension ve; // expected-error {{variable has incomplete type 'enum gccForwardEnumExtension'}} expected-warning{{ISO C forbids forward references to 'enum' types}}
int test2(int i)
{
- ve + i; // expected-error{{invalid operands to binary expression ('enum gccForwardEnumExtension' and 'int')}}
+ ve + i;
}
--- /dev/null
+// RUN: clang -fsyntax-only -verify %s
+
+void b; // expected-error {{variable has incomplete type 'void'}}
+struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
+
+static void c; // expected-error {{variable has incomplete type 'void'}}
+static struct foo g; // expected-error {{variable has incomplete type 'struct foo'}}
+
+extern void d;
+extern struct foo e;
+
+void func() {
+ void b; // expected-error {{variable has incomplete type 'void'}}
+ struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
+}