diff options
-rw-r--r-- | Sema/SemaDecl.cpp | 5 | ||||
-rw-r--r-- | test/Parser/implicit-casts.c | 2 | ||||
-rw-r--r-- | test/Sema/function.c | 4 | ||||
-rw-r--r-- | test/Sema/predefined-function.c | 4 |
4 files changed, 11 insertions, 4 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 24013cd9dd..6a718aef91 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1010,10 +1010,11 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) { FTI.ArgInfo[i].TypeInfo = Context.IntTy.getAsOpaquePtr(); } } - + // Since this is a function definition, act as though we have information // about the arguments. - FTI.hasPrototype = true; + if (FTI.NumArgs) + FTI.hasPrototype = true; } else { // FIXME: Diagnose arguments without names in C. diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c index 1636f4993e..2e8e000182 100644 --- a/test/Parser/implicit-casts.c +++ b/test/Parser/implicit-casts.c @@ -14,7 +14,7 @@ void test2() { } int test3() { int a[2]; - a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int (void)', expected 'int'}} + a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int ()', expected 'int'}} } short x; void test4(char c) { x += c; } int y; void test5(char c) { y += c; } diff --git a/test/Sema/function.c b/test/Sema/function.c index 8ef453581f..2a18dbb705 100644 --- a/test/Sema/function.c +++ b/test/Sema/function.c @@ -25,3 +25,7 @@ int t8(, int a); // expected-error {{expected parameter declarator}} int t9(int a, ); // expected-error {{expected parameter declarator}} +// PR2042 +void t10(){} +void t11(){t10(1);} + diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c index 1dcd1d38a2..daade82b46 100644 --- a/test/Sema/predefined-function.c +++ b/test/Sema/predefined-function.c @@ -20,16 +20,18 @@ int bar(int i) // expected-error {{previous definition is here}} { return 0; } -int bar() // expected-error {{redefinition of 'bar'}} expected-error {{conflicting types for 'bar'}} +int bar() // expected-error {{redefinition of 'bar'}} { return 0; } +#if 0 int foobar(int); // expected-error {{previous declaration is here}} int foobar() // expected-error {{conflicting types for 'foobar'}} { return 0; } +#endif int wibble(); // expected-error {{previous declaration is here}} float wibble() // expected-error {{conflicting types for 'wibble'}} |