]> granicus.if.org Git - clang/commitdiff
Fix bz1950. ASTContext::functionTypesAreCompatible() needs to operate on the unqualif...
authorSteve Naroff <snaroff@apple.com>
Tue, 29 Jan 2008 00:15:50 +0000 (00:15 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 29 Jan 2008 00:15:50 +0000 (00:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46472 91177308-0d34-0410-b5e6-96231b3b80d8

AST/ASTContext.cpp
test/Sema/function.c

index 242a684b0a4a6841936e5c5ee35c446a694e8e93..c86cf6797cf8ee7c09d85f81da40e7066b8aebe2 100644 (file)
@@ -1579,7 +1579,10 @@ bool ASTContext::functionTypesAreCompatible(QualType lhs, QualType rhs) {
       
     // 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;
   }
index 3f6ad96637cc82d95afebae9884d4cb5b3d2ace0..34e523586c5316b32f1affc32df951b34740920e 100644 (file)
@@ -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)()) {
 }