[cfe-commits] r46472 - in /cfe/trunk: AST/ASTContext.cpp test/Sema/function.c
Steve Naroff
snaroff at apple.com
Mon Jan 28 16:15:51 PST 2008
Author: snaroff
Date: Mon Jan 28 18:15:50 2008
New Revision: 46472
URL: http://llvm.org/viewvc/llvm-project?rev=46472&view=rev
Log:
Fix bz1950. ASTContext::functionTypesAreCompatible() needs to operate on the unqualified parameter types (per C99 6.7.5.3p15).
Modified:
cfe/trunk/AST/ASTContext.cpp
cfe/trunk/test/Sema/function.c
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=46472&r1=46471&r2=46472&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Jan 28 18:15:50 2008
@@ -1579,7 +1579,10 @@
// The use of ellipsis agree...now check the argument types.
for (unsigned i = 0; i < lproto_nargs; i++)
- if (!typesAreCompatible(lproto->getArgType(i), rproto->getArgType(i)))
+ // C99 6.7.5.3p15: ...and each parameter declared with qualified type
+ // is taken as having the unqualified version of it's declared type.
+ if (!typesAreCompatible(lproto->getArgType(i).getUnqualifiedType(),
+ rproto->getArgType(i).getUnqualifiedType()))
return false;
return true;
}
Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=46472&r1=46471&r2=46472&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Mon Jan 28 18:15:50 2008
@@ -3,6 +3,9 @@
void f(double a[restrict][5]); // should promote to restrict ptr.
void f(double (* restrict a)[5]);
+int foo (__const char *__path);
+int foo(__const char *__restrict __file);
+
void g(int (*)(const void **, const void **));
void g(int (*compar)()) {
}
More information about the cfe-commits
mailing list